File: __init__.py

package info (click to toggle)
python-formencode 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,856 kB
  • sloc: python: 6,772; makefile: 130; sh: 96; javascript: 61
file content (26 lines) | stat: -rw-r--r-- 880 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import sys
import warnings

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

# Make sure messages are not translated when running the tests
# (setting the environment variable here may be too late already,
# in this case you must set it manually before running the tests).
os.environ['LANGUAGE'] = 'C'

# Enable deprecation warnings (which are disabled by default)
warnings.simplefilter('default')

try:
    try:
        import importlib.metadata as metadata
        try:
            metadata.distribution("FormEncode")
        except metadata.PackageNotFoundError as error:
            raise ImportError from error
    except ImportError:  # Python < 3.8
        import pkg_resources
        pkg_resources.require('FormEncode')
except ImportError as error:
    raise ImportError("Install FormEncode before running the tests") from error