diff options
| author | Tarek Ziade <tarek@ziade.org> | 2010-10-25 02:00:47 +0200 |
|---|---|---|
| committer | Tarek Ziade <tarek@ziade.org> | 2010-10-25 02:00:47 +0200 |
| commit | 3a2f924196e82ff2c2bdcff9188357c509c41320 (patch) | |
| tree | 515387487062dcf19b21d0cbe9408e130dee98ed /distutils2/tests/test_run.py | |
| parent | 5dbdebe52132f6dbfbf63919a20fa339624a0cb6 (diff) | |
| download | disutils2-3a2f924196e82ff2c2bdcff9188357c509c41320.tar.gz | |
removed core.py
Diffstat (limited to 'distutils2/tests/test_run.py')
| -rw-r--r-- | distutils2/tests/test_run.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/distutils2/tests/test_run.py b/distutils2/tests/test_run.py new file mode 100644 index 0000000..e66c7f4 --- /dev/null +++ b/distutils2/tests/test_run.py @@ -0,0 +1,61 @@ +"""Tests for distutils2.run.""" + +import StringIO +import os +import shutil +import sys + +import distutils2 +from distutils2.tests import captured_stdout +from distutils2.tests import unittest, support + +# setup script that uses __file__ +setup_using___file__ = """\ + +__file__ + +from distutils2.run import setup +setup() +""" + +setup_prints_cwd = """\ + +import os +print os.getcwd() + +from distutils2.run import setup +setup() +""" + + +class CoreTestCase(support.EnvironGuard, unittest.TestCase): + + def setUp(self): + super(CoreTestCase, self).setUp() + self.old_stdout = sys.stdout + self.cleanup_testfn() + self.old_argv = sys.argv, sys.argv[:] + + def tearDown(self): + sys.stdout = self.old_stdout + self.cleanup_testfn() + sys.argv = self.old_argv[0] + sys.argv[:] = self.old_argv[1] + super(CoreTestCase, self).tearDown() + + def cleanup_testfn(self): + path = distutils2.tests.TESTFN + if os.path.isfile(path): + os.remove(path) + elif os.path.isdir(path): + shutil.rmtree(path) + + def write_setup(self, text, path=distutils2.tests.TESTFN): + open(path, "w").write(text) + return path + +def test_suite(): + return unittest.makeSuite(CoreTestCase) + +if __name__ == "__main__": + unittest.main(defaultTest="test_suite") |
