summaryrefslogtreecommitdiff
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
parent0770b89680db77306658b0817ac4c35e339adac4 (diff)
downloadpystache-9447214e6bd58376bf12c29b1d9e929a0f827d60.tar.gz
Fixed an issue whereby setup.py was not importable when running tox.
-rw-r--r--pystache/tests/main.py14
-rw-r--r--setup.py6
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
diff --git a/setup.py b/setup.py
index 6051fba..ee42dfe 100644
--- a/setup.py
+++ b/setup.py
@@ -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',