Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bb93d177
Commit
bb93d177
authored
Mar 31, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example for new copydir_run_2to3().
parent
fa1fcd10
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
Demo/distutils/test2to3/setup.py
Demo/distutils/test2to3/setup.py
+2
-2
Demo/distutils/test2to3/test/runtests.py
Demo/distutils/test2to3/test/runtests.py
+19
-0
Demo/distutils/test2to3/test/test_foo.py
Demo/distutils/test2to3/test/test_foo.py
+8
-0
No files found.
Demo/distutils/test2to3/setup.py
View file @
bb93d177
...
...
@@ -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
,
}
)
Demo/distutils/test2to3/test/runtests.py
0 → 100644
View file @
bb93d177
# 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
()
Demo/distutils/test2to3/test/test_foo.py
0 → 100644
View file @
bb93d177
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment