summaryrefslogtreecommitdiff
path: root/pystache/tests/main.py
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-04-23 18:27:47 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-04-23 18:27:47 -0700
commit9447214e6bd58376bf12c29b1d9e929a0f827d60 (patch)
tree8e59709a588d655368586c436f6c500248e742a8 /pystache/tests/main.py
parent0770b89680db77306658b0817ac4c35e339adac4 (diff)
downloadpystache-9447214e6bd58376bf12c29b1d9e929a0f827d60.tar.gz
Fixed an issue whereby setup.py was not importable when running tox.
Diffstat (limited to 'pystache/tests/main.py')
-rw-r--r--pystache/tests/main.py14
1 files changed, 12 insertions, 2 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