Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
8b742694
Commit
8b742694
authored
Apr 06, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap unittest.main in a compatibility wrapper for Python 3.1 compatibility. Fixes #183
parent
d5f19d2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
CHANGES.txt
CHANGES.txt
+6
-0
setuptools/command/test.py
setuptools/command/test.py
+7
-4
setuptools/py31compat.py
setuptools/py31compat.py
+15
-0
No files found.
CHANGES.txt
View file @
8b742694
...
...
@@ -2,6 +2,12 @@
CHANGES
=======
-----
3.4.2
-----
* Issue #183: Fix additional regression in test command on Python 3.1.
-----
3.4.1
-----
...
...
setuptools/command/test.py
View file @
8b742694
import
unittest
from
unittest
import
TestLoader
from
setuptools
import
Command
from
distutils.errors
import
DistutilsOptionError
import
sys
from
pkg_resources
import
(
resource_listdir
,
resource_exists
,
normalize_path
,
working_set
,
_namespace_packages
,
add_activation_listener
,
require
,
EntryPoint
)
from
unittest
import
TestLoader
from
setuptools.py31compat
import
unittest_main
class
ScanningLoader
(
TestLoader
):
...
...
@@ -141,8 +146,6 @@ class test(Command):
self
.
with_project_on_sys_path
(
self
.
run_tests
)
def
run_tests
(
self
):
import
unittest
# Purge modules under test from sys.modules. The test loader will
# re-import them from the build location. Required when 2to3 is used
# with namespace packages.
...
...
@@ -158,7 +161,7 @@ class test(Command):
del_modules
.
append
(
name
)
list
(
map
(
sys
.
modules
.
__delitem__
,
del_modules
))
unittest
.
main
(
unittest
_
main
(
None
,
None
,
[
unittest
.
__file__
]
+
self
.
test_args
,
testLoader
=
self
.
_resolve_as_ep
(
self
.
test_loader
),
testRunner
=
self
.
_resolve_as_ep
(
self
.
test_runner
),
...
...
setuptools/py31compat.py
View file @
8b742694
import
sys
import
unittest
__all__
=
[
'get_config_vars'
,
'get_path'
]
try
:
...
...
@@ -35,3 +38,15 @@ except ImportError:
except
OSError
:
#removal errors are not the only possible
pass
self
.
name
=
None
unittest_main
=
unittest
.
main
_PY31
=
(
3
,
1
)
<=
sys
.
version_info
[:
2
]
<
(
3
,
2
)
if
_PY31
:
# on Python 3.1, translate testRunner==None to defaultTestLoader
# for compatibility with Python 2.6, 2.7, and 3.2+
def
unittest_main
(
*
args
,
**
kwargs
):
if
'testRunner'
in
kwargs
and
kwargs
[
'testRunner'
]
is
None
:
kwargs
[
'testRunner'
]
=
unittest
.
defaultTestLoader
return
unittest
.
main
(
*
args
,
**
kwargs
)
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