summaryrefslogtreecommitdiffstats
path: root/Demo/distutils
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-03-31 00:33:15 (GMT)
committerGeorg Brandl <georg@python.org>2009-03-31 00:33:15 (GMT)
commitbb93d177701e219e940a9ad8c3a96eb29427ec81 (patch)
tree212ab83c5282d1a0def1a927a42a6cebcf322759 /Demo/distutils
parentfa1fcd107d0c90396b082a93f2de266bc769f003 (diff)
downloadcpython-bb93d177701e219e940a9ad8c3a96eb29427ec81.zip
cpython-bb93d177701e219e940a9ad8c3a96eb29427ec81.tar.gz
cpython-bb93d177701e219e940a9ad8c3a96eb29427ec81.tar.bz2
Add example for new copydir_run_2to3().
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)