diff options
-rw-r--r-- | pystache/tests/main.py | 14 | ||||
-rw-r--r-- | setup.py | 6 |
2 files changed, 15 insertions, 5 deletions
diff --git a/pystache/tests/main.py b/pystache/tests/main.py index c75664e..bcc30cc 100644 --- a/pystache/tests/main.py +++ b/pystache/tests/main.py @@ -52,6 +52,7 @@ def run_tests(sys_argv): _PystacheTestProgram._text_doctest_dir = project_dir _PystacheTestProgram._spec_test_dir = spec_test_dir + SetupTests.project_dir = project_dir # We pass None for the module because we do not want the unittest # module to resolve module names relative to a given module. @@ -85,13 +86,22 @@ class SetupTests(unittest.TestCase): """Tests about setup.py.""" + project_dir = None + def test_version(self): """ Test that setup.py's version matches the package's version. """ - from setup import VERSION - self.assertEqual(VERSION, pystache.__version__) + original_path = list(sys.path) + + sys.path.insert(0, self.project_dir) + + try: + from setup import VERSION + self.assertEqual(VERSION, pystache.__version__) + finally: + sys.path = original_path # The function unittest.main() is an alias for unittest.TestProgram's @@ -120,9 +120,6 @@ if sys.argv[-1] == 'publish': publish() sys.exit() -long_description = make_long_description() -template_files = ['*.mustache', '*.txt'] - # We follow the guidance here for compatibility with using setuptools instead # of Distribute under Python 2 (on the subject of new, unrecognized keyword # arguments to setup()): @@ -169,6 +166,9 @@ PACKAGES = [ def main(sys_argv): + long_description = make_long_description() + template_files = ['*.mustache', '*.txt'] + setup(name='pystache', version=VERSION, license='MIT', |