Skip to content

Commit

Permalink
Formatting fixes for eggsupport.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Nov 14, 2017
1 parent eeac886 commit 8d43f1c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
31 changes: 16 additions & 15 deletions src/zope/testrunner/eggsupport.py
Expand Up @@ -13,7 +13,7 @@ def skipLayers(suite, _result=None):
if _result is None:
_result = TestSuite()
# Sometimes test suites do not have tests, like DocFileSuite.
if len(suite._tests) == 0:
if not suite._tests:
_result.addTest(suite)
return _result
for test in suite._tests:
Expand All @@ -27,19 +27,20 @@ def skipLayers(suite, _result=None):
return _result

class SkipLayers(ScanningLoader):
"""Load only unit tests (those which have no layer associated with
"""
Load only unit tests (those which have no layer associated with
them).
o Running the tests using 'setup.py test' cannot, by default,
drive the full testrunner, with its support for layers (in
functional tests). This loader allows the command to work, by
running only those tests which don't need the layer support.
* Running the tests using 'setup.py test' cannot, by default,
drive the full testrunner, with its support for layers (in
functional tests). This loader allows the command to work, by
running only those tests which don't need the layer support.
o To run layer-dependent tests, use 'setup.py ftest' (see below
for adding the command to your setup.py).
* To run layer-dependent tests, use 'setup.py ftest' (see below
for adding the command to your setup.py).
o To use this loader your package add the following your 'setup()'
call::
* To use this loader your package add the following your 'setup()'
call::
setup(
...
Expand Down Expand Up @@ -70,26 +71,26 @@ class ftest(BaseCommand):
"""
Run unit and functional tests after an in-place build.
o Note that this command runs *all* tests (unit *and* functional).
* Note that this command runs *all* tests (unit *and* functional).
o This command does not provide any of the configuration options which
* This command does not provide any of the configuration options which
the usual testrunner provided by 'zope.testrunner' offers: it is intended
to allow easy verification that a package has been installed correctly
via setuptools, but is not likely to be useful for developers working
on the package.
o Developers working on the package will likely prefer to work with
* Developers working on the package will likely prefer to work with
the stock testrunner, e.g., by using buildout with a recipe which
configures the testrunner as a standalone script.
o To use this in your pacakge add the following to the 'entry_points'
* To use this in your pacakge add the following to the 'entry_points'
section::
setup(
...
setup_requires=[
'zope.testrunner',
'eggtestinfo' # captures testing metadata in EGG-INFO
'eggtestinfo' # captures testing metadata in EGG-INFO
],
...
)
Expand Down
9 changes: 5 additions & 4 deletions src/zope/testrunner/options.py
Expand Up @@ -156,7 +156,7 @@
""")

reporting.add_option(
'--no-progress',action="store_false", dest='progress',
'--no-progress', action="store_false", dest='progress',
help="""\
Do not output progress status. This is the default, but can be used to
counter a previous use of --progress or -p.
Expand Down Expand Up @@ -594,7 +594,7 @@ def apply_auto_progress(args):
if positional:
parser.error("Too many positional arguments")

options.ignore_dir = dict([(d,1) for d in options.ignore_dir])
options.ignore_dir = dict([(d, 1) for d in options.ignore_dir])
options.test_file_pattern = re.compile(options.test_file_pattern).search
options.tests_pattern = re.compile(options.tests_pattern).search
options.test = [t for t in options.test or ('.')]
Expand All @@ -608,7 +608,7 @@ def apply_auto_progress(args):
+
[(os.path.abspath(path), package)
for (path, package) in options.package_path or ()
])
])

if options.package:
pkgmap = dict(options.test_path)
Expand Down Expand Up @@ -666,7 +666,7 @@ def apply_auto_progress(args):

return options

def normalize_package(package, package_map={}):
def normalize_package(package, package_map=None):
r"""Normalize package name passed to the --package option.
>>> normalize_package('zope.testrunner')
Expand Down Expand Up @@ -697,6 +697,7 @@ def normalize_package(package, package_map={}):
'zope.something.tests'
"""
package_map = {} if package_map is None else package_map
package = package.replace('\\', '/')
if package.endswith('/'):
package = package[:-1]
Expand Down

0 comments on commit 8d43f1c

Please sign in to comment.