diff options
author | Alex Stewart <alex@foogod.com> | 2010-09-01 10:50:10 -0700 |
---|---|---|
committer | Alex Stewart <alex@foogod.com> | 2010-09-01 10:50:10 -0700 |
commit | b98f0b1e46bfa4a2f11012d1c2d28caf59163864 (patch) | |
tree | 087b75aa65da004da459f61d603d0191b002ff92 /selftest.py | |
parent | 4f8f0086e245a554c1c8f1ea9a6371a42b907eaf (diff) | |
download | nose-b98f0b1e46bfa4a2f11012d1c2d28caf59163864.tar.gz |
Moved 3.x test build directories to build/tests instead of build/lib so it doesn't get included in eggs, etc.
Diffstat (limited to 'selftest.py')
-rw-r--r-- | selftest.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/selftest.py b/selftest.py index 6493f3a..436e773 100644 --- a/selftest.py +++ b/selftest.py @@ -29,21 +29,26 @@ import sys if __name__ == "__main__": this_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__))) + lib_dir = this_dir if sys.version_info >= (3,): # Under Python 3.x, we need to 'build' the source (using 2to3, etc) - # first, so it will be located under build/lib/nose instead of this - # dir. - this_dir = os.path.join(this_dir, 'build', 'lib') + # first. 'python3 setup.py build_tests' will put everything under + # build/tests (including nose itself, since some tests are inside the + # nose source), so we'll run from that directory instead. + lib_dir = os.path.join(this_dir, 'build', 'lib') + this_dir = os.path.join(this_dir, 'build', 'tests') + if not os.path.isdir(this_dir): + raise AssertionError("Error: %s does not exist. Use the setup.py 'build_tests' command to create it." % (this_dir,)) try: import pkg_resources - env = pkg_resources.Environment(search_path=[this_dir]) + env = pkg_resources.Environment(search_path=[lib_dir]) distributions = env["nose"] assert len(distributions) == 1 dist = distributions[0] dist.activate() except ImportError: pass - # Always make sure our chosen version is first on the path + # Always make sure our chosen test dir is first on the path sys.path.insert(0, this_dir) os.chdir(this_dir) import nose |