Closed kloczek closed 3 years ago
Hi @kloczek
our test suite works both in CI and locally, see
lint: commands succeeded
py27: commands succeeded
py35: commands succeeded
py36: commands succeeded
py37: commands succeeded
py38: commands succeeded
py39: commands succeeded
ERROR: pypy: InterpreterNotFound: pypy
ERROR: pypy3: InterpreterNotFound: pypy3
coverage: commands succeeded
The linting error you encounter
lint run-test: commands[1] | check-manifest
Couldn't find version control data (git/hg/bzr/svn supported)
is caused by your setup, as you probably do not run the source code from checkout, but it looks like you copy or move it beforehands.
In order to get a successful tox
run, you would need to prefix the check-manifest
call with a minus (-), or comment it out. Or run tox
as we do - with the checked out source code.
We do not support arbitrary test runners.
We run all our test suites via tox
only, so I think there is not much we can do for you.
I do not see that the tests are failing: The py38
and coverage
tox environments ran successfully. The lint
environment is made for running against a checkout. pytest
is not used to run the tests of this package so I see no problem that trying to run them with this test runner fails. (We use zope.testrunner
here.)
I am closing this issue now, feel free to reopen if there are still open questions.
This is because tox using pytest in virtenv is using exact set of modules. Sometimes it is good to install few pytest instead of raw tox use pytest to have some additional filters/scanners.
Looks like you misunderstood ,my intentions. I'm not asking you to install all pytest extensions which I have. I'm asking only to have closer look on above output because it may be some real issue.
I do not see any issue here.
As @jugmac00 explained: the failure in the lint
environment is because you seem to run the tests on a release instated of a git clone.
The warning you encounter has nothing to you with the many plug-ins you installed but it is caused by using the wrong test runner. To repeat myself: pytest
cannot be used to run the test suite of zope.testing
.
If you dont see something that may not always mean that everything is fine.
Here pytest used with black
.
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zope-testing-4.10-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zope-testing-4.10-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib --black
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10
plugins: black-0.3.12
collected 37 items
setup.py F [ 2%]
docs/conf.py F [ 5%]
src/zope/__init__.py F [ 8%]
src/zope/testing/__init__.py . [ 10%]
src/zope/testing/cleanup.py . [ 13%]
src/zope/testing/doctestcase.py F [ 16%]
src/zope/testing/exceptions.py F [ 18%]
src/zope/testing/formparser.py F [ 21%]
src/zope/testing/loggingsupport.py F [ 24%]
src/zope/testing/loghandler.py F [ 27%]
src/zope/testing/module.py F [ 29%]
src/zope/testing/renormalizing.py F [ 32%]
src/zope/testing/server.py F [ 35%]
src/zope/testing/setupstack.py F [ 37%]
src/zope/testing/test-1.txt F [ 40%]
src/zope/testing/test4.txt F [ 43%]
src/zope/testing/test4e.txt . [ 45%]
src/zope/testing/test4f.txt F [ 48%]
src/zope/testing/test_renormalizing.py F............... [ 91%]
src/zope/testing/testrunner.py F [ 94%]
src/zope/testing/tests.py F [ 97%]
src/zope/testing/wait.py F [100%]
================================================================================= FAILURES =================================================================================
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/setup.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/setup.py 2022-05-20 13:38:51.805984 +0000
@@ -25,22 +25,22 @@
def read(*rnames):
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()
-long_description = read('README.rst') + '\n\n' + read('CHANGES.rst')
+long_description = read("README.rst") + "\n\n" + read("CHANGES.rst")
keywords = "zope testing doctest RENormalizing OutputChecker timeout logging"
setup(
- name='zope.testing',
- version='4.10',
- url='https://github.com/zopefoundation/zope.testing',
- license='ZPL 2.1',
- description='Zope testing helpers',
+ name="zope.testing",
+ version="4.10",
+ url="https://github.com/zopefoundation/zope.testing",
+ license="ZPL 2.1",
+ description="Zope testing helpers",
long_description=long_description,
- author='Zope Foundation and Contributors',
- author_email='zope-dev@zope.org',
+ author="Zope Foundation and Contributors",
+ author_email="zope-dev@zope.org",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"Operating System :: OS Independent",
@@ -65,26 +65,26 @@
keywords=keywords,
packages=[
"zope",
"zope.testing",
],
- package_dir={'': 'src'},
- namespace_packages=['zope'],
+ package_dir={"": "src"},
+ namespace_packages=["zope"],
install_requires=[
- 'setuptools',
+ "setuptools",
],
extras_require={
- 'test': [
- 'zope.testrunner',
+ "test": [
+ "zope.testrunner",
],
- 'docs': [
- 'sphinx',
- 'repoze.sphinx.autointerface',
- 'zope.exceptions',
- 'zope.interface',
- 'mock; python_version == "2.7"'
+ "docs": [
+ "sphinx",
+ "repoze.sphinx.autointerface",
+ "zope.exceptions",
+ "zope.interface",
+ 'mock; python_version == "2.7"',
],
},
include_package_data=True,
zip_safe=False,
- test_suite='zope.testing.tests.test_suite',
+ test_suite="zope.testing.tests.test_suite",
)
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/docs/conf.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/docs/conf.py 2022-05-20 13:38:52.122142 +0000
@@ -13,271 +13,286 @@
# serve to show the default.
import sys
import os
import pkg_resources
-sys.path.append(os.path.abspath('../src'))
-rqmt = pkg_resources.require('zope.testing')[0]
+
+sys.path.append(os.path.abspath("../src"))
+rqmt = pkg_resources.require("zope.testing")[0]
# Import and document the pure-python versions of things; they tend to have better
# docstrings and signatures.
-os.environ['PURE_PYTHON'] = '1'
+os.environ["PURE_PYTHON"] = "1"
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# 1.3 adds autodoc_mock_imports
-needs_sphinx = '1.3'
+needs_sphinx = "1.3"
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.todo',
- 'sphinx.ext.ifconfig',
- 'sphinx.ext.viewcode',
- 'repoze.sphinx.autointerface',
+ "sphinx.ext.autodoc",
+ "sphinx.ext.doctest",
+ "sphinx.ext.intersphinx",
+ "sphinx.ext.todo",
+ "sphinx.ext.ifconfig",
+ "sphinx.ext.viewcode",
+ "repoze.sphinx.autointerface",
]
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
+templates_path = ["_templates"]
# The suffix of source filenames.
-source_suffix = '.rst'
+source_suffix = ".rst"
# The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
# The master toctree document.
-master_doc = 'index'
+master_doc = "index"
# General information about the project.
-project = 'zope.testing'
-copyright = '2012-2021, Zope Foundation contributors'
+project = "zope.testing"
+copyright = "2012-2021, Zope Foundation contributors"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '%s.%s' % tuple(map(int, rqmt.version.split('.')[:2]))
+version = "%s.%s" % tuple(map(int, rqmt.version.split(".")[:2]))
# The full version, including alpha/beta/rc tags.
release = rqmt.version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-#language = None
+# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
-#today = ''
+# today = ''
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
-exclude_patterns = ['_build']
+exclude_patterns = ["_build"]
# The reST default role (used for this markup: `text`) to use for all documents.
-default_role = 'obj'
+default_role = "obj"
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
+pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-html_theme = 'default'
+html_theme = "default"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-#html_theme_options = {}
+# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-#html_title = None
+# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = None
+# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-#html_favicon = None
+# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+html_static_path = ["_static"]
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
# If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
# If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
# Output file base name for HTML help builder.
-htmlhelp_basename = 'zopetestingdoc'
+htmlhelp_basename = "zopetestingdoc"
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+ # The paper size ('letterpaper' or 'a4paper').
+ #'papersize': 'letterpaper',
+ # The font size ('10pt', '11pt' or '12pt').
+ #'pointsize': '10pt',
+ # Additional stuff for the LaTeX preamble.
+ #'preamble': '',
}
# pdflatex can't handle Cyrillic out of the box, but xetext/lualatex should be
# able to cope
-latex_engine = 'lualatex'
+latex_engine = "lualatex"
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'zopetesting.tex', 'zope.testing Documentation',
- 'Zope Foundation contributors', 'manual'),
+ (
+ "index",
+ "zopetesting.tex",
+ "zope.testing Documentation",
+ "Zope Foundation contributors",
+ "manual",
+ ),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-#latex_logo = None
+# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
# If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
# If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
# If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'zopetesting', 'zope.testing Documentation',
- ['Zope Foundation contributors'], 1)
+ (
+ "index",
+ "zopetesting",
+ "zope.testing Documentation",
+ ["Zope Foundation contributors"],
+ 1,
+ )
]
# If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'zopetesting', 'zope.testing Documentation',
- 'Zope Foundation contributors', 'zopetesting', 'One line description of project.',
- 'Miscellaneous'),
+ (
+ "index",
+ "zopetesting",
+ "zope.testing Documentation",
+ "Zope Foundation contributors",
+ "zopetesting",
+ "One line description of project.",
+ "Miscellaneous",
+ ),
]
# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = []
# If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote'
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
- 'https://docs.python.org/': None,
- 'https://zopetestbrowser.readthedocs.io/en/latest/': None,
+ "https://docs.python.org/": None,
+ "https://zopetestbrowser.readthedocs.io/en/latest/": None,
}
# Sphinx 1.8+ prefers this to `autodoc_default_flags`. It's documented that
# either True or None mean the same thing as just setting the flag, but
# only None works in 1.8 (True works in 2.0)
autodoc_default_options = {
- 'members': None,
- 'show-inheritance': None,
+ "members": None,
+ "show-inheritance": None,
}
-autodoc_member_order = 'bysource'
-autoclass_content = 'both'
-
-doctest_global_setup = '''
+autodoc_member_order = "bysource"
+autoclass_content = "both"
+
+doctest_global_setup = """
from zope.testing.tests import print_
-'''
+"""
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/__init__.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/__init__.py 2022-05-20 13:38:52.341500 +0000
@@ -1 +1 @@
-__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
+__import__("pkg_resources").declare_namespace(__name__) # pragma: no cover
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/doctestcase.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/doctestcase.py 2022-05-20 13:38:53.190276 +0000
@@ -7,29 +7,26 @@
import re
import sys
import types
__all__ = [
- 'doctestmethod',
- 'method',
-
- 'docteststring',
- 'string',
-
- 'doctestfile',
- 'file',
-
- 'doctestfiles',
- 'files',
+ "doctestmethod",
+ "method",
+ "docteststring",
+ "string",
+ "doctestfile",
+ "file",
+ "doctestfiles",
+ "files",
]
_parser = doctest.DocTestParser()
def _testify(name):
- if not name.startswith('test'):
- name = 'test_' + name
+ if not name.startswith("test"):
+ name = "test_" + name
return name
def doctestmethod(test=None, optionflags=0, checker=None):
"""Define a doctest from a method within a unittest.TestCase.
@@ -67,12 +64,13 @@
fglobs = sys._getframe(3).f_globals
def test_method(self):
setup(self)
- _run_test(self, doc, fglobs.copy(), name, path,
- optionflags, checker, lineno=lineno)
+ _run_test(
+ self, doc, fglobs.copy(), name, path, optionflags, checker, lineno=lineno
+ )
test_method.__name__ = _testify(name)
return test_method
@@ -90,22 +88,24 @@
The test object is available as the variable ``self`` in the test.
"""
fglobs = sys._getframe(2).f_globals
def test_string(self):
- _run_test(self, test, fglobs.copy(), '<string>', '<string>',
- optionflags, checker)
+ _run_test(
+ self, test, fglobs.copy(), "<string>", "<string>", optionflags, checker
+ )
+
if name:
test_string.__name__ = _testify(name)
return test_string
#: Alias of `docteststring`
string = docteststring
-_not_word = re.compile(r'\W')
+_not_word = re.compile(r"\W")
def doctestfile(path, optionflags=0, checker=None):
"""Define a doctest from a test file within a unittest.TestCase.
@@ -122,13 +122,11 @@
The resulting object can be used as a function decorator. The
decorated method is called before the test and may perform
test-specific setup. (The decorated method's doc string is ignored.)
"""
- base = os.path.dirname(os.path.abspath(
- sys._getframe(2).f_globals['__file__']
- ))
+ base = os.path.dirname(os.path.abspath(sys._getframe(2).f_globals["__file__"]))
path = os.path.join(base, path)
with open(path) as f:
test = f.read()
name = os.path.basename(path)
@@ -136,19 +134,18 @@
if isinstance(self, types.FunctionType):
setup = self
def test_file_w_setup(self):
setup(self)
- _run_test(self, test, {}, name, path, optionflags, checker,
- 'test')
+ _run_test(self, test, {}, name, path, optionflags, checker, "test")
test_file_w_setup.__name__ = _testify(setup.__name__)
test_file_w_setup.filepath = path
test_file_w_setup.filename = os.path.basename(path)
return test_file_w_setup
- _run_test(self, test, {}, name, path, optionflags, checker, 'test')
+ _run_test(self, test, {}, name, path, optionflags, checker, "test")
test_file.__name__ = name_from_path(path)
test_file.filepath = path
test_file.filename = os.path.basename(path)
@@ -176,10 +173,11 @@
The test object is available as the variable ``test`` in the test.
The resulting object must be used as a class decorator.
"""
+
def doctestfiles_(class_):
for path in paths:
name = name_from_path(path)
test = doctestfile(path, **kw)
test.__name__ = name
@@ -193,20 +191,19 @@
#: Alias of `doctestfiles`
files = doctestfiles
def name_from_path(path):
- return _testify(
- _not_word.sub('_', os.path.splitext(os.path.basename(path))[0])
- )
-
-
-def _run_test(self, test, globs, name, path,
- optionflags, checker, testname='self', lineno=0):
- globs.update(getattr(self, 'globs', ()))
+ return _testify(_not_word.sub("_", os.path.splitext(os.path.basename(path))[0]))
+
+
+def _run_test(
+ self, test, globs, name, path, optionflags, checker, testname="self", lineno=0
+):
+ globs.update(getattr(self, "globs", ()))
globs[testname] = self
optionflags |= doctest.IGNORE_EXCEPTION_DETAIL
doctest.DocTestCase(
_parser.get_doctest(test, globs, name, path, lineno),
optionflags=optionflags,
checker=checker,
- ).runTest()
+ ).runTest()
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/exceptions.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/exceptions.py 2022-05-20 13:38:53.413383 +0000
@@ -13,14 +13,16 @@
##############################################################################
"""Exceptions for zope.testing
"""
import warnings
+
# Tell people to use the builtin module instead.
warnings.warn(
- 'zope.testing.exceptions is deprecated in favour of '
- 'zope.testrunner.exceptions', DeprecationWarning,
- stacklevel=2)
+ "zope.testing.exceptions is deprecated in favour of " "zope.testrunner.exceptions",
+ DeprecationWarning,
+ stacklevel=2,
+)
class DocTestFailureException(AssertionError):
"""Use custom exception for doctest unit test failures"""
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/formparser.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/formparser.py 2022-05-20 13:38:53.961670 +0000
@@ -38,10 +38,11 @@
class FormParser(object):
"""
The parser.
"""
+
def __init__(self, data, base=None):
self.data = data
self.base = base
self._parser = HTMLParser.HTMLParser()
self._parser.handle_data = self._handle_data
@@ -107,20 +108,31 @@
src = urlparse.urljoin(self.base, src)
value = d.get("value")
size = intattr(d, "size")
maxlength = intattr(d, "maxlength")
self._add_field(
- Input(name, id, type, value, checked,
- disabled, readonly, src, size, maxlength))
+ Input(
+ name,
+ id,
+ type,
+ value,
+ checked,
+ disabled,
+ readonly,
+ src,
+ size,
+ maxlength,
+ )
+ )
elif tag == "button":
pass
elif tag == "textarea":
disabled = "disabled" in d
readonly = "readonly" in d
- self.textarea = Input(name, id, "textarea", None,
- None, disabled, readonly,
- None, None, None)
+ self.textarea = Input(
+ name, id, "textarea", None, None, disabled, readonly, None, None, None
+ )
self.textarea.rows = intattr(d, "rows")
self.textarea.cols = intattr(d, "cols")
self._add_field(self.textarea)
# The value will be set when the </textarea> is seen.
elif tag == "base":
@@ -206,12 +218,13 @@
"""Input element."""
rows = None
cols = None
- def __init__(self, name, id, type, value, checked, disabled, readonly,
- src, size, maxlength):
+ def __init__(
+ self, name, id, type, value, checked, disabled, readonly, src, size, maxlength
+ ):
super(Input, self).__init__()
self.name = name
self.id = id
self.type = type
self.value = value
@@ -225,12 +238,13 @@
class Select(Input):
"""Select element."""
def __init__(self, name, id, disabled, multiple, size):
- super(Select, self).__init__(name, id, "select", None, None,
- disabled, None, None, size, None)
+ super(Select, self).__init__(
+ name, id, "select", None, None, disabled, None, None, size, None
+ )
self.options = []
self.multiple = multiple
if multiple:
self.value = []
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/loggingsupport.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/loggingsupport.py 2022-05-20 13:38:54.255993 +0000
@@ -66,18 +66,18 @@
logger = logging.getLogger(name)
logger.setLevel(self.oldlevels[name])
logger.removeHandler(self)
def __str__(self):
- return '\n'.join(
- "%s %s\n %s" % (
- record.name, record.levelname,
- '\n'.join(
- line
- for line in record.getMessage().split('\n')
- if line.strip()
- ),
+ return "\n".join(
+ "%s %s\n %s"
+ % (
+ record.name,
+ record.levelname,
+ "\n".join(
+ line for line in record.getMessage().split("\n") if line.strip()
+ ),
)
for record in self.records
)
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/loghandler.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/loghandler.py 2022-05-20 13:38:54.553920 +0000
@@ -19,12 +19,15 @@
import logging
import warnings
warnings.warn(
- 'zope.testing.loghandler.Handler is deprecated. It probably'
- ' does not work on Python 3.', DeprecationWarning, stacklevel=2)
+ "zope.testing.loghandler.Handler is deprecated. It probably"
+ " does not work on Python 3.",
+ DeprecationWarning,
+ stacklevel=2,
+)
class Handler(logging.Handler):
"""Handler for use with `unittest.TestCase` objects.
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/module.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/module.py 2022-05-20 13:38:54.836302 +0000
@@ -17,12 +17,12 @@
"""
import sys
__all__ = [
- 'setUp',
- 'tearDown',
+ "setUp",
+ "tearDown",
]
class FakeModule(object):
def __init__(self, dict):
@@ -36,31 +36,31 @@
def __dir__(self):
return self.__dict.keys()
-def setUp(test, name='__main__'):
+def setUp(test, name="__main__"):
"""
Replace the module named *name* with a fake version.
"""
dict = test.globs
- dict['__name__'] = name
+ dict["__name__"] = name
module = FakeModule(dict)
sys.modules[name] = module
- if '.' in name:
- name = name.split('.')
- parent = sys.modules['.'.join(name[:-1])]
+ if "." in name:
+ name = name.split(".")
+ parent = sys.modules[".".join(name[:-1])]
setattr(parent, name[-1], module)
def tearDown(test, name=None):
"""
Remove the (fake) module named *name*.
"""
if name is None:
- name = test.globs['__name__']
- del test.globs['__name__']
+ name = test.globs["__name__"]
+ del test.globs["__name__"]
del sys.modules[name]
- if '.' in name:
- name = name.split('.')
- parent = sys.modules['.'.join(name[:-1])]
+ if "." in name:
+ name = name.split(".")
+ parent = sys.modules[".".join(name[:-1])]
delattr(parent, name[-1])
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/renormalizing.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/renormalizing.py 2022-05-20 13:38:55.218723 +0000
@@ -20,11 +20,12 @@
import re
import sys
IGNORE_EXCEPTION_MODULE_IN_PYTHON2 = doctest.register_optionflag(
- 'IGNORE_EXCEPTION_MODULE_IN_PYTHON2')
+ "IGNORE_EXCEPTION_MODULE_IN_PYTHON2"
+)
IGNORE_EXCEPTION_MODULE_IN_PYTHON2_HINT = """\
===============================================================
HINT:
The optionflag IGNORE_EXCEPTION_MODULE_IN_PYTHON2 is set.
You seem to test traceback output.
@@ -35,12 +36,11 @@
split over multiple lines).
==============================================================="""
class OutputChecker(doctest.OutputChecker):
- """Pattern-normalizing output checker
- """
+ """Pattern-normalizing output checker"""
def __init__(self, patterns=None):
if patterns is None:
patterns = []
self.transformers = list(map(self._cook, patterns))
@@ -49,11 +49,11 @@
if not isinstance(other, RENormalizing):
return NotImplemented
return RENormalizing(self.transformers + other.transformers)
def _cook(self, pattern):
- if hasattr(pattern, '__call__'):
+ if hasattr(pattern, "__call__"):
return pattern
regexp, replacement = pattern
return lambda text: regexp.sub(replacement, text)
def check_output(self, want, got, optionflags):
@@ -68,12 +68,11 @@
return True
if sys.version_info[0] < 3: # pragma: PY2
if optionflags & IGNORE_EXCEPTION_MODULE_IN_PYTHON2:
want = strip_dottedname_from_traceback(want)
- if doctest.OutputChecker.check_output(
- self, want, got, optionflags):
+ if doctest.OutputChecker.check_output(self, want, got, optionflags):
return True
return False
def output_difference(self, example, got, optionflags):
@@ -84,11 +83,12 @@
# when setting up tests for the first time. In that case, we
# generally use the differencer to display output, which we evaluate
# by hand.
if not want.strip():
return doctest.OutputChecker.output_difference(
- self, example, got, optionflags)
+ self, example, got, optionflags
+ )
# Dang, this isn't as easy to override as we might wish
original = want
for transformer in self.transformers:
@@ -102,29 +102,27 @@
if optionflags & IGNORE_EXCEPTION_MODULE_IN_PYTHON2:
if maybe_a_traceback(got) is not None:
got += IGNORE_EXCEPTION_MODULE_IN_PYTHON2_HINT
result = doctest.OutputChecker.output_difference(
- self, example, got, optionflags)
+ self, example, got, optionflags
+ )
example.want = original
return result
RENormalizing = OutputChecker
def is_dotted_name(name):
if sys.version_info[0] >= 3: # pragma: PY3
- return (
- name and
- all(element.isidentifier() for element in name.split('.')))
+ return name and all(element.isidentifier() for element in name.split("."))
else: # pragma: PY2
# Python 2 lacked str.isidentifier, but also restricted identifiers
# to ASCII so a regex match is straightforward.
- match = re.match(
- r'^(?:[A-Za-z_][A-Za-z0-9_]*\.)*[A-Za-z_][A-Za-z0-9_]*$', name)
+ match = re.match(r"^(?:[A-Za-z_][A-Za-z0-9_]*\.)*[A-Za-z_][A-Za-z0-9_]*$", name)
return match is not None
def maybe_a_traceback(string):
# We wanted to confirm more strictly we're dealing with a traceback here.
@@ -136,13 +134,13 @@
lines = string.splitlines()
last = lines[-1]
if not last:
return None
- words = last.split(' ')
+ words = last.split(" ")
first = words[0]
- if len(words) > 1 and not first.endswith(':'):
+ if len(words) > 1 and not first.endswith(":"):
return None
# If IGNORE_EXCEPTION_MODULE_IN_PYTHON2 was applied to an entire file,
# then this may run on strings that aren't the exception message part of
# a traceback. The doctest interface makes it impossible to detect this
# reasonably, so do our best to restrict this to only lines that start
@@ -159,10 +157,10 @@
maybe = maybe_a_traceback(string)
if maybe is None:
return string
lines, last, words, first = maybe
- name = first.split('.')[-1]
+ name = first.split(".")[-1]
words[0] = name
- last = ' '.join(words)
+ last = " ".join(words)
lines[-1] = last
- return '\n'.join(lines)
+ return "\n".join(lines)
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/server.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/server.py 2022-05-20 13:38:55.541358 +0000
@@ -25,10 +25,11 @@
from __future__ import print_function
import sys
import warnings
import webbrowser
+
# XXX: I don't think this module works on Python 3!
try: # pragma: PY3
from urllib import parse as urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -37,15 +38,17 @@
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
def makeRequestHandler(http, user=None, password=None): # pragma: PY2
warnings.warn(
- 'zope.testing.server.makeRequestHandler is deprecated. It probably'
- ' does not work on Python 3.', DeprecationWarning, stacklevel=2)
+ "zope.testing.server.makeRequestHandler is deprecated. It probably"
+ " does not work on Python 3.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
class FunctionalTestRequestHandler(BaseHTTPRequestHandler):
-
def do_GET(self):
request = self.raw_requestline
if user and password:
# Authentication is built in, as there is no fluent
# way of transferring session from functional test to
@@ -53,14 +56,14 @@
request += "Authorization: Basic %s:%s\r\n" % (user, password)
# Write headers to the request
for header in self.headers.headers:
request += header
- request += '\r\n'
+ request += "\r\n"
- if self.headers.get('Content-Length'):
- data = self.rfile.read(int(self.headers.get('Content-Length')))
+ if self.headers.get("Content-Length"):
+ data = self.rfile.read(int(self.headers.get("Content-Length")))
request += data
else:
# if no content-length was set - read until the last
# char, then finish
self.request.setblocking(0)
@@ -80,37 +83,40 @@
def addPortToURL(url, port):
"""Add a port number to the url.
- >>> from zope.testing.server import addPortToURL
- >>> addPortToURL('http://localhost/foo/bar/baz.html', 3000)
- 'http://localhost:3000/foo/bar/baz.html'
- >>> addPortToURL('http://foo.bar.com/index.html?param=some-value', 555)
- 'http://foo.bar.com:555/index.html?param=some-value'
+ >>> from zope.testing.server import addPortToURL
+ >>> addPortToURL('http://localhost/foo/bar/baz.html', 3000)
+ 'http://localhost:3000/foo/bar/baz.html'
+ >>> addPortToURL('http://foo.bar.com/index.html?param=some-value', 555)
+ 'http://foo.bar.com:555/index.html?param=some-value'
- >>> addPortToURL('http://localhost:666/index.html', 555)
- 'http://localhost:555/index.html'
+ >>> addPortToURL('http://localhost:666/index.html', 555)
+ 'http://localhost:555/index.html'
"""
(scheme, netloc, url, query, fragment) = urlparse.urlsplit(url)
- netloc = netloc.split(':')[0]
+ netloc = netloc.split(":")[0]
netloc = "%s:%s" % (netloc, port)
url = urlparse.urlunsplit((scheme, netloc, url, query, fragment))
return url
def startServer(http, url, user=None, password=None, port=8000): # pragma: PY2
warnings.warn(
- 'zope.testing.server.startServer is deprecated. It probably'
- ' does not work on Python 3.', DeprecationWarning, stacklevel=2)
+ "zope.testing.server.startServer is deprecated. It probably"
+ " does not work on Python 3.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
try:
- server_address = ('', port)
+ server_address = ("", port)
requestHandler = makeRequestHandler(http, user, password)
url = addPortToURL(url, port)
httpd = HTTPServer(server_address, requestHandler)
# XXX we rely on browser being slower than our server
webbrowser.open(url)
- print('Starting HTTP server...', file=sys.stderr)
+ print("Starting HTTP server...", file=sys.stderr)
httpd.serve_forever()
except KeyboardInterrupt:
- print('Stopped HTTP server.', file=sys.stderr)
+ print("Stopped HTTP server.", file=sys.stderr)
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/setupstack.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/setupstack.py 2022-05-20 13:38:55.865420 +0000
@@ -20,11 +20,11 @@
import stat
import tempfile
import unittest
-key = '__' + __name__
+key = "__" + __name__
def globs(test):
"""
Return the globals for *test*, which can be a `doctest`
___________________________________________________________________________ [doctest] test-1.txt ___________________________________________________________________________
001 >>> test.a
UNEXPECTED EXCEPTION: NameError("name 'test' is not defined")
Traceback (most recent call last):
File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest test-1.txt[0]>", line 1, in <module>
NameError: name 'test' is not defined
/home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/test-1.txt:1: UnexpectedException
___________________________________________________________________________ [doctest] test4.txt ____________________________________________________________________________
001 >>> test.a, test.x, c
UNEXPECTED EXCEPTION: NameError("name 'test' is not defined")
Traceback (most recent call last):
File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest test4.txt[0]>", line 1, in <module>
NameError: name 'test' is not defined
/home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/test4.txt:1: UnexpectedException
___________________________________________________________________________ [doctest] test4f.txt ___________________________________________________________________________
001 >>> test.x
UNEXPECTED EXCEPTION: NameError("name 'test' is not defined")
Traceback (most recent call last):
File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
exec(compile(example.source, filename, "single",
File "<doctest test4f.txt[0]>", line 1, in <module>
NameError: name 'test' is not defined
/home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/test4f.txt:1: UnexpectedException
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/test_renormalizing.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/test_renormalizing.py 2022-05-20 13:38:56.218311 +0000
@@ -7,98 +7,117 @@
strip_dottedname_from_traceback,
)
class Exception2To3(unittest.TestCase):
-
def test_is_dotted_name_ascii_no_dots(self):
- self.assertTrue(is_dotted_name('FooBarError'))
+ self.assertTrue(is_dotted_name("FooBarError"))
def test_is_dotted_name_ascii_dots(self):
- self.assertTrue(is_dotted_name('foo.bar.FooBarError'))
+ self.assertTrue(is_dotted_name("foo.bar.FooBarError"))
def test_is_dotted_name_unicode_no_dots(self):
- result = is_dotted_name(u'FooB\xe1rError')
+ result = is_dotted_name("FooB\xe1rError")
if sys.version_info[0] >= 3: # pragma: PY3
self.assertTrue(result)
else: # pragma: PY2
self.assertFalse(result)
def test_is_dotted_name_unicode_dots(self):
- result = is_dotted_name(u'foo.b\xe1r.FooB\xe1rError')
+ result = is_dotted_name("foo.b\xe1r.FooB\xe1rError")
if sys.version_info[0] >= 3: # pragma: PY3
self.assertTrue(result)
else: # pragma: PY2
self.assertFalse(result)
def test_is_dotted_name_ellipsis(self):
- self.assertFalse(is_dotted_name('...'))
+ self.assertFalse(is_dotted_name("..."))
def test_is_dotted_name_not_identifier(self):
- self.assertFalse(is_dotted_name('foo=bar'))
+ self.assertFalse(is_dotted_name("foo=bar"))
def test_strip_dottedname(self):
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
Traceback (most recent call last):
- foo.bar.FooBarError: requires at least one argument.""")
- expected = textwrap.dedent("""\
+ foo.bar.FooBarError: requires at least one argument."""
+ )
+ expected = textwrap.dedent(
+ """\
Traceback (most recent call last):
- FooBarError: requires at least one argument.""")
+ FooBarError: requires at least one argument."""
+ )
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_strip_dottedname_without_exception_arguments(self):
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
Traceback (most recent call last):
- foo.bar.FooBarError""")
- expected = textwrap.dedent("""\
+ foo.bar.FooBarError"""
+ )
+ expected = textwrap.dedent(
+ """\
Traceback (most recent call last):
- FooBarError""")
+ FooBarError"""
+ )
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_no_dots_in_name(self):
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
Traceback (most recent call last):
- FooBarError: requires at least one argument.""")
- expected = textwrap.dedent("""\
+ FooBarError: requires at least one argument."""
+ )
+ expected = textwrap.dedent(
+ """\
Traceback (most recent call last):
- FooBarError: requires at least one argument.""")
+ FooBarError: requires at least one argument."""
+ )
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_no_colon_in_first_word(self):
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
Traceback (most recent call last):
- foo.bar.FooBarError requires at least one argument.""")
- expected = textwrap.dedent("""\
+ foo.bar.FooBarError requires at least one argument."""
+ )
+ expected = textwrap.dedent(
+ """\
Traceback (most recent call last):
- foo.bar.FooBarError requires at least one argument.""")
+ foo.bar.FooBarError requires at least one argument."""
+ )
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_input_empty(self):
- string = ''
- expected = ''
+ string = ""
+ expected = ""
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_input_spaces(self):
- string = ' '
- expected = ' '
+ string = " "
+ expected = " "
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_input_ellipsis(self):
- string = '...'
- expected = '...'
+ string = "..."
+ expected = "..."
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_input_last_line_not_dotted_name(self):
- string = 'foo=bar'
- expected = 'foo=bar'
+ string = "foo=bar"
+ expected = "foo=bar"
self.assertEqual(expected, strip_dottedname_from_traceback(string))
def test_last_line_empty(self):
- string = textwrap.dedent("""\
+ string = textwrap.dedent(
+ """\
Traceback (most recent call last):
- """)
- expected = textwrap.dedent("""\
+ """
+ )
+ expected = textwrap.dedent(
+ """\
Traceback (most recent call last):
- """)
+ """
+ )
self.assertEqual(expected, strip_dottedname_from_traceback(string))
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/testrunner.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/testrunner.py 2022-05-20 13:38:56.474234 +0000
@@ -1,11 +1,16 @@
import warnings
-warnings.warn('zope.testing.testrunner is deprecated in favour of '
- 'zope.testrunner', DeprecationWarning, stacklevel=2)
+
+warnings.warn(
+ "zope.testing.testrunner is deprecated in favour of " "zope.testrunner",
+ DeprecationWarning,
+ stacklevel=2,
+)
try:
from zope import testrunner
import zope.testing
+
# Now replace this module with the right one:
zope.testing.testrunner = testrunner
except ImportError:
pass
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/tests.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/tests.py 2022-05-20 13:38:56.767533 +0000
@@ -18,48 +18,66 @@
from zope.testing import renormalizing
from zope.testing.test_renormalizing import Exception2To3
def print_(*args):
- sys.stdout.write(' '.join(map(str, args))+'\n')
+ sys.stdout.write(" ".join(map(str, args)) + "\n")
def setUp(test):
- test.globs['print_'] = print_
+ test.globs["print_"] = print_
def test_suite():
- suite = unittest.TestSuite((
- doctest.DocFileSuite(
- 'module.txt',
- # Python 3.3 changed exception messaging:
- # https://bugs.launchpad.net/zope.testing/+bug/1055720
- # and then Python 3.6 introduced ImportError subclasses
- checker=renormalizing.RENormalizing([
- (re.compile('ModuleNotFoundError:'), 'ImportError:'),
- (re.compile(
- "No module named '?zope.testing.unlikelymodulename'?"),
- 'No module named unlikelymodulename'),
- (re.compile("No module named '?fake'?"),
- 'No module named fake')])),
- doctest.DocFileSuite('loggingsupport.txt', setUp=setUp),
- doctest.DocFileSuite('renormalizing.txt', setUp=setUp),
- doctest.DocFileSuite('setupstack.txt', setUp=setUp),
- doctest.DocFileSuite(
- 'wait.txt', setUp=setUp,
- checker=renormalizing.RENormalizing([
- # For Python 3.4.
- (re.compile('zope.testing.wait.TimeOutWaitingFor: '),
- 'TimeOutWaitingFor: '),
- # For Python 3.5
- (re.compile('zope.testing.wait.Wait.TimeOutWaitingFor: '),
- 'TimeOutWaitingFor: '),
- ])
- ),
- ))
+ suite = unittest.TestSuite(
+ (
+ doctest.DocFileSuite(
+ "module.txt",
+ # Python 3.3 changed exception messaging:
+ # https://bugs.launchpad.net/zope.testing/+bug/1055720
+ # and then Python 3.6 introduced ImportError subclasses
+ checker=renormalizing.RENormalizing(
+ [
+ (re.compile("ModuleNotFoundError:"), "ImportError:"),
+ (
+ re.compile(
+ "No module named '?zope.testing.unlikelymodulename'?"
+ ),
+ "No module named unlikelymodulename",
+ ),
+ (
+ re.compile("No module named '?fake'?"),
+ "No module named fake",
+ ),
+ ]
+ ),
+ ),
+ doctest.DocFileSuite("loggingsupport.txt", setUp=setUp),
+ doctest.DocFileSuite("renormalizing.txt", setUp=setUp),
+ doctest.DocFileSuite("setupstack.txt", setUp=setUp),
+ doctest.DocFileSuite(
+ "wait.txt",
+ setUp=setUp,
+ checker=renormalizing.RENormalizing(
+ [
+ # For Python 3.4.
+ (
+ re.compile("zope.testing.wait.TimeOutWaitingFor: "),
+ "TimeOutWaitingFor: ",
+ ),
+ # For Python 3.5
+ (
+ re.compile("zope.testing.wait.Wait.TimeOutWaitingFor: "),
+ "TimeOutWaitingFor: ",
+ ),
+ ]
+ ),
+ ),
+ )
+ )
- suite.addTests(doctest.DocFileSuite('doctestcase.txt'))
- suite.addTests(doctest.DocFileSuite('cleanup.txt'))
+ suite.addTests(doctest.DocFileSuite("doctestcase.txt"))
+ suite.addTests(doctest.DocFileSuite("cleanup.txt"))
suite.addTest(unittest.makeSuite(Exception2To3))
- suite.addTests(doctest.DocTestSuite('zope.testing.server'))
- suite.addTests(doctest.DocFileSuite('formparser.txt', setUp=setUp))
+ suite.addTests(doctest.DocTestSuite("zope.testing.server"))
+ suite.addTests(doctest.DocFileSuite("formparser.txt", setUp=setUp))
return suite
____________________________________________________________________________ Black format check ____________________________________________________________________________
--- /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/wait.py 2022-03-07 07:06:27 +0000
+++ /home/tkloczko/rpmbuild/BUILD/zope.testing-4.10/src/zope/testing/wait.py 2022-05-20 13:38:57.040353 +0000
@@ -34,15 +34,20 @@
"The default exception raised when a test condition timed out."
#: The default timeout value.
timeout = 9
#: The default amount of time to sleep between polls.
- wait = .01
+ wait = 0.01
- def __init__(self,
- timeout=None, wait=None, exception=None,
- getnow=lambda: time.time, getsleep=lambda: time.sleep):
+ def __init__(
+ self,
+ timeout=None,
+ wait=None,
+ exception=None,
+ getnow=lambda: time.time,
+ getsleep=lambda: time.sleep,
+ ):
if timeout is not None:
self.timeout = timeout
if wait is not None:
@@ -74,13 +79,11 @@
sleep(wait)
if func():
return
if now() > deadline:
raise self.TimeOutWaitingFor(
- message or
- getattr(func, '__doc__') or
- getattr(func, '__name__')
+ message or getattr(func, "__doc__") or getattr(func, "__name__")
)
#: The default instance of `Wait`.
wait = Wait()
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:146: 18 warnings
/usr/lib/python3.8/site-packages/_pytest/nodes.py:146: PytestDeprecationWarning: <class 'pytest_black.BlackItem'> is not using a cooperative constructor and only takes {'fspath', 'parent'}.
See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
warnings.warn(
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264: 18 warnings
/usr/lib/python3.8/site-packages/_pytest/nodes.py:264: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to BlackItem is deprecated. Please use the (path: pathlib.Path) argument instead.
See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
return cls._create(parent=parent, **kw)
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:708
/usr/lib/python3.8/site-packages/_pytest/nodes.py:708: PytestWarning: BlackItem is an Item subclass and should not be a collector, however its bases File are collectors.
Please split the Collectors and the Item into separate node types.
Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
FAILED setup.py::BLACK
FAILED docs/conf.py::BLACK
FAILED src/zope/__init__.py::BLACK
FAILED src/zope/testing/doctestcase.py::BLACK
FAILED src/zope/testing/exceptions.py::BLACK
FAILED src/zope/testing/formparser.py::BLACK
FAILED src/zope/testing/loggingsupport.py::BLACK
FAILED src/zope/testing/loghandler.py::BLACK
FAILED src/zope/testing/module.py::BLACK
FAILED src/zope/testing/renormalizing.py::BLACK
FAILED src/zope/testing/server.py::BLACK
FAILED src/zope/testing/setupstack.py::BLACK
FAILED src/zope/testing/test-1.txt::test-1.txt
FAILED src/zope/testing/test4.txt::test4.txt
FAILED src/zope/testing/test4f.txt::test4f.txt
FAILED src/zope/testing/test_renormalizing.py::BLACK
FAILED src/zope/testing/testrunner.py::BLACK
FAILED src/zope/testing/tests.py::BLACK
FAILED src/zope/testing/wait.py::BLACK
================================================================ 19 failed, 18 passed, 37 warnings in 5.70s ================================================================
As you see there are even some PytestDeprecationWarning
warnings.
tox:
and pytest: