diff options
author | Michael Merickel <michael@merickel.org> | 2022-05-15 21:13:30 -0500 |
---|---|---|
committer | Michael Merickel <michael@merickel.org> | 2022-05-15 21:23:28 -0500 |
commit | 1c50e71feec86a42c8ce5432106136f09edeb9e9 (patch) | |
tree | 77ac2c5e733a02a87b5010d548fd0f29abb29081 | |
parent | 32fb766fa01d436b98e7687f717f6e71c58b9a83 (diff) | |
download | pastedeploy-git-1c50e71feec86a42c8ce5432106136f09edeb9e9.tar.gz |
move fixtures into the setup code for the test suite
-rw-r--r-- | tests/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index b555435..555181c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,12 +1,28 @@ import os +import shutil import sys here = os.path.dirname(__file__) base = os.path.dirname(here) sys.path.insert(0, base) +test_dir = os.path.dirname(__file__) +egg_info_dir = os.path.join(test_dir, 'fake_packages', 'FakeApp.egg', 'EGG-INFO') +info_dir = os.path.join(test_dir, 'fake_packages', 'FakeApp.egg', 'FakeApp.egg-info') +if not os.path.exists(egg_info_dir): + try: + os.symlink(info_dir, egg_info_dir) + except Exception: + shutil.copytree(info_dir, egg_info_dir) + +sys.path.append(os.path.dirname(egg_info_dir)) + import pkg_resources # noqa E402 # Make absolutely sure we're testing *this* package, not # some other installed package pkg_resources.require('PasteDeploy') + +# ensure FakeApp is available for use by tests +pkg_resources.working_set.add_entry(os.path.dirname(egg_info_dir)) +pkg_resources.require('FakeApp') |