Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Kirill Smelkov
ZODB
Commits
f2ba643d
Commit
f2ba643d
authored
May 10, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip non-unit tests in 'setup.py test'.
Use the buildout to run these tests.
parent
e90a3ceb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
CHANGES.rst
CHANGES.rst
+3
-0
setup.py
setup.py
+19
-2
No files found.
CHANGES.rst
View file @
f2ba643d
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
4.0.0
b1
(
unreleased
)
4.0.0
b1
(
unreleased
)
=====================
=====================
-
Skip
non
-
unit
tests
in
``
setup
.
py
test
``.
Use
the
buildout
to
run
these
tests
.
-
Added
support
for
Python
3.2
/
3.3
.
-
Added
support
for
Python
3.2
/
3.3
.
-
Include
the
filename
in
the
exception
message
to
support
debugging
in
case
-
Include
the
filename
in
the
exception
message
to
support
debugging
in
case
...
...
setup.py
View file @
f2ba643d
...
@@ -60,6 +60,23 @@ def _modname(path, base, name=''):
...
@@ -60,6 +60,23 @@ def _modname(path, base, name=''):
dirname
,
basename
=
os
.
path
.
split
(
path
)
dirname
,
basename
=
os
.
path
.
split
(
path
)
return
_modname
(
dirname
,
base
,
basename
+
'.'
+
name
)
return
_modname
(
dirname
,
base
,
basename
+
'.'
+
name
)
def
_flatten
(
suite
,
predicate
=
lambda
*
x
:
True
):
from
unittest
import
TestCase
for
suite_or_case
in
suite
:
if
predicate
(
suite_or_case
):
if
isinstance
(
suite_or_case
,
TestCase
):
yield
suite_or_case
else
:
for
x
in
_flatten
(
suite_or_case
):
yield
x
def
_no_layer
(
suite_or_case
):
return
getattr
(
suite_or_case
,
'layer'
,
None
)
is
None
def
_unittests_only
(
suite
,
mod_suite
):
for
case
in
_flatten
(
mod_suite
,
_no_layer
):
suite
.
addTest
(
case
)
def
alltests
():
def
alltests
():
import
logging
import
logging
import
pkg_resources
import
pkg_resources
...
@@ -87,10 +104,10 @@ def alltests():
...
@@ -87,10 +104,10 @@ def alltests():
mod
=
__import__
(
mod
=
__import__
(
_modname
(
dirpath
,
base
,
os
.
path
.
splitext
(
filename
)[
0
]),
_modname
(
dirpath
,
base
,
os
.
path
.
splitext
(
filename
)[
0
]),
{},
{},
[
'*'
])
{},
{},
[
'*'
])
suite
.
addTest
(
mod
.
test_suite
())
_unittests_only
(
suite
,
mod
.
test_suite
())
elif
'tests.py'
in
filenames
:
elif
'tests.py'
in
filenames
:
mod
=
__import__
(
_modname
(
dirpath
,
base
,
'tests'
),
{},
{},
[
'*'
])
mod
=
__import__
(
_modname
(
dirpath
,
base
,
'tests'
),
{},
{},
[
'*'
])
suite
.
addTest
(
mod
.
test_suite
())
_unittests_only
(
suite
,
mod
.
test_suite
())
return
suite
return
suite
doclines
=
__doc__
.
split
(
"
\
n
"
)
doclines
=
__doc__
.
split
(
"
\
n
"
)
...
...
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