summaryrefslogtreecommitdiffstats
path: root/Demo/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/distutils')
-rw-r--r--Demo/distutils/test2to3/setup.py4
-rw-r--r--Demo/distutils/test2to3/test/runtests.py19
-rw-r--r--Demo/distutils/test2to3/test/test_foo.py8
3 files changed, 29 insertions, 2 deletions
diff --git a/Demo/distutils/test2to3/setup.py b/Demo/distutils/test2to3/setup.py
index deb9a69..a0f9024 100644
--- a/Demo/distutils/test2to3/setup.py
+++ b/Demo/distutils/test2to3/setup.py
@@ -20,7 +20,7 @@ setup(
license = "PSF license",
packages = ["test2to3"],
scripts = ["maintest.py"],
- cmdclass = {'build_py':build_py,
- 'build_scripts':build_scripts,
+ cmdclass = {'build_py': build_py,
+ 'build_scripts': build_scripts,
}
)
diff --git a/Demo/distutils/test2to3/test/runtests.py b/Demo/distutils/test2to3/test/runtests.py
new file mode 100644
index 0000000..1730f0d
--- /dev/null
+++ b/Demo/distutils/test2to3/test/runtests.py
@@ -0,0 +1,19 @@
+# Fictitious test runner for the project
+
+import sys, os
+
+if sys.version_info > (3,):
+ # copy test suite over to "build/lib" and convert it
+ from distutils.util import copydir_run_2to3
+ testroot = os.path.dirname(__file__)
+ newroot = os.path.join(testroot, '..', 'build/lib/test')
+ copydir_run_2to3(testroot, newroot)
+ # in the following imports, pick up the converted modules
+ sys.path[0] = newroot
+
+# run the tests here...
+
+from test_foo import FooTest
+
+import unittest
+unittest.main()
diff --git a/Demo/distutils/test2to3/test/test_foo.py b/Demo/distutils/test2to3/test/test_foo.py
new file mode 100644
index 0000000..ec8f26a
--- /dev/null
+++ b/Demo/distutils/test2to3/test/test_foo.py
@@ -0,0 +1,8 @@
+import sys
+import unittest
+
+class FooTest(unittest.TestCase):
+ def test_foo(self):
+ # use 2.6 syntax to demonstrate conversion
+ print 'In test_foo, using Python %s...' % (sys.version_info,)
+ self.assertTrue(False)