commit python-nose2 for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-nose2 for openSUSE:Factory checked in at 2024-06-05 17:42:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nose2 (Old) and /work/SRC/openSUSE:Factory/.python-nose2.new.24587 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-nose2" Wed Jun 5 17:42:20 2024 rev:15 rq:1178617 version:0.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nose2/python-nose2.changes 2024-05-08 11:42:32.318910815 +0200 +++ /work/SRC/openSUSE:Factory/.python-nose2.new.24587/python-nose2.changes 2024-06-05 17:43:04.387575860 +0200 @@ -1,0 +2,24 @@ +Tue Jun 4 20:42:07 UTC 2024 - Dirk Müller <dmueller@suse.com> + +- update to 0.15.1: + * Fix a bug with config loading which caused custom ini configs + not to load if they were not named with a .cfg extension. + Thanks :user:`grhwalls` for the bug report! + * Official support for python3.13 betas. nose2 now tests itself + against Python 3.13. + * Official support for python3.13 betas. nose2 now tests itself + against Python 3.13. + * nose2 now supports loading configuration data from the + tool.nose2 table in pyproject.toml. Thanks to :user:`qequ` + for the PR! (:pr:`596`, :pr:`606`) On python 3.11+, tomllib + is used to parse TOML data. On python 3.10 and lower, tomli + must be installed to enable TOML support. Simply pip install + tomli as necessary. + * nose2 now supports loading configuration data from the + tool.nose2 table in pyproject.toml. Thanks to :user:`qequ` + for the PR! (:pr:`596`, :pr:`606`) + * On python 3.11+, tomllib is used to parse TOML data. On + python 3.10 and lower, tomli must be installed to enable TOML + support. Simply pip install tomli as necessary. + +------------------------------------------------------------------- Old: ---- nose2-0.14.2.tar.gz New: ---- nose2-0.15.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nose2.spec ++++++ --- /var/tmp/diff_new_pack.AWtKDH/_old 2024-06-05 17:43:05.187604996 +0200 +++ /var/tmp/diff_new_pack.AWtKDH/_new 2024-06-05 17:43:05.191605141 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-nose2 -Version: 0.14.2 +Version: 0.15.1 Release: 0 Summary: The successor to the Python testing framework nose, based on unittest License: BSD-2-Clause AND Python-2.0 ++++++ nose2-0.14.2.tar.gz -> nose2-0.15.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/MANIFEST.in new/nose2-0.15.1/MANIFEST.in --- old/nose2-0.14.2/MANIFEST.in 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/MANIFEST.in 2024-05-31 03:06:08.000000000 +0200 @@ -3,7 +3,7 @@ include unittest.cfg include README.rst include license.txt -recursive-include nose2/tests/functional/support *.py *.txt *.cfg *.rst *.json *.egg .coveragerc +recursive-include nose2/tests/functional/support *.py *.txt *.toml *.cfg *.rst *.json *.egg .coveragerc recursive-include docs *.inc *.py *.rst Makefile global-exclude __pycache__ global-exclude *~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/PKG-INFO new/nose2-0.15.1/PKG-INFO --- old/nose2-0.14.2/PKG-INFO 2024-05-07 16:49:53.142876000 +0200 +++ new/nose2-0.15.1/PKG-INFO 2024-06-01 05:20:00.930882000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nose2 -Version: 0.14.2 +Version: 0.15.1 Summary: unittest with plugins Author-email: Stephen Rosen <dev@nose2.io> License: BSD-2-Clause @@ -32,9 +32,9 @@ Provides-Extra: coverage-plugin Requires-Dist: coverage; extra == "coverage-plugin" Provides-Extra: dev -Requires-Dist: Sphinx; extra == "dev" +Requires-Dist: sphinx; extra == "dev" Requires-Dist: sphinx-issues; extra == "dev" -Requires-Dist: sphinx_rtd_theme; extra == "dev" +Requires-Dist: sphinx-rtd-theme; extra == "dev" .. image:: https://results.pre-commit.ci/badge/github/nose-devs/nose2/main.svg :target: https://results.pre-commit.ci/latest/github/nose-devs/nose2/main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/docs/changelog.rst new/nose2-0.15.1/docs/changelog.rst --- old/nose2-0.14.2/docs/changelog.rst 2024-05-07 16:49:26.000000000 +0200 +++ new/nose2-0.15.1/docs/changelog.rst 2024-06-01 05:19:28.000000000 +0200 @@ -13,9 +13,39 @@ Unreleased ---------- +0.15.1 (2024-05-31) +------------------- + +Fixed +~~~~~ + +* Fix a bug with config loading which caused custom ini configs not to load if + they were not named with a ``.cfg`` extension. Thanks :user:`grhwalls` for + the bug report! + +0.15.0 (2024-05-30) +------------------- + +Added +~~~~~ + +* Official support for ``python3.13`` betas. ``nose2`` now tests itself against + Python 3.13. + +* ``nose2`` now supports loading configuration data from the ``tool.nose2`` + table in ``pyproject.toml``. Thanks to :user:`qequ` for the PR! (:pr:`596`, + :pr:`606`) + + On python 3.11+, ``tomllib`` is used to parse TOML data. On python 3.10 and + lower, ``tomli`` must be installed to enable TOML support. Simply + ``pip install tomli`` as necessary. + 0.14.2 (2024-05-07) ------------------- +Added +~~~~~ + * For the coverage plugin, add a config option, ``coverage-combine``, which defaults to ``False``. When set, this config invokes a ``coverage combine`` step before reporting results, regardless of whether or not multiprocessing @@ -26,6 +56,9 @@ 0.14.1 (2024-01-28) ------------------- +Fixed +~~~~~ + * Fix the reporting of skipped tests in verbose mode on newer pythons (3.12.1+), in which a skipped test is no longer treated as "started". @@ -35,26 +68,42 @@ 0.14.0 (2023-10-04) ------------------- +Added +~~~~~ + * Add official support for ``python3.12`` + +Removed +~~~~~~~ + * Remove support for ``python3.6`` and ``python3.7`` 0.13.0 (2023-04-29) ------------------- -* Remove support for python2 and older python3 versions - -* Fix support for python3.12 to avoid warnings about ``addDuration``. - Thanks to :user:`cclauss` for the fix! +Changed +~~~~~~~ * ``nose2`` package metadata is converted to pyproject.toml format, using ``setuptools``. Building ``nose2`` packages from source now requires ``setuptools>=61.0.0`` or a PEP 517 compatible build frontend (e.g. ``build``). +Fixed +~~~~~ + +* Fix support for python3.12 to avoid warnings about ``addDuration``. + Thanks to :user:`cclauss` for the fix! + * ``nose2`` license metadata has been corrected in format and content to be distributed in the sdist and wheel distributions correctly. Thanks :user:`musicinmybrain` for helping research this issue! +Removed +~~~~~~~ + +* Remove support for python2 and older python3 versions + 0.12.0 (2022-07-16) ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/__init__.py new/nose2-0.15.1/nose2/__init__.py --- old/nose2-0.14.2/nose2/__init__.py 2024-05-07 16:49:26.000000000 +0200 +++ new/nose2-0.15.1/nose2/__init__.py 2024-06-01 05:18:52.000000000 +0200 @@ -1,5 +1,5 @@ from nose2.main import discover, main -__version__ = "0.14.2" +__version__ = "0.15.1" __all__ = ("__version__", "discover", "main") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/_toml.py new/nose2-0.15.1/nose2/_toml.py --- old/nose2-0.14.2/nose2/_toml.py 1970-01-01 01:00:00.000000000 +0100 +++ new/nose2-0.15.1/nose2/_toml.py 2024-06-01 04:04:39.000000000 +0200 @@ -0,0 +1,26 @@ +from __future__ import annotations + +import types + +TOML_ENABLED: bool = False +toml: types.ModuleType | None = None + +try: + import tomllib as toml + + TOML_ENABLED = True +except ImportError: + try: + import tomli as toml + + TOML_ENABLED = True + except ImportError: + toml = None + TOML_ENABLED = False + + +def load_toml(file: str) -> dict: + if toml is None: + raise RuntimeError("toml library not found. Please install 'tomli'.") + with open(file, "rb") as fp: + return toml.load(fp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/events.py new/nose2-0.15.1/nose2/events.py --- old/nose2-0.14.2/nose2/events.py 2024-04-28 01:10:38.000000000 +0200 +++ new/nose2-0.15.1/nose2/events.py 2024-06-01 04:04:39.000000000 +0200 @@ -3,9 +3,11 @@ # code developed in reference to that module and others within unittest2. # unittest2 is Copyright (c) 2001-2010 Python Software Foundation; All # Rights Reserved. See: http://docs.python.org/license.html +from __future__ import annotations import argparse import logging +import typing as t import unittest from nose2 import config, util @@ -315,7 +317,7 @@ "handleDir", # ... etc? ) - hookClass = Hook + hookClass: type[Hook] = Hook def __init__(self): self.hooks = {} @@ -362,7 +364,7 @@ """ - _attrs = ("handled",) + _attrs: t.ClassVar[tuple[str, ...]] = ("handled",) version = "0.4" def __init__(self, **metadata): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/main.py new/nose2-0.15.1/nose2/main.py --- old/nose2-0.14.2/nose2/main.py 2024-04-28 06:23:35.000000000 +0200 +++ new/nose2-0.15.1/nose2/main.py 2024-05-31 03:06:08.000000000 +0200 @@ -4,6 +4,7 @@ import unittest from nose2 import events, loader, plugins, runner, session, util +from nose2._toml import TOML_ENABLED log = logging.getLogger(__name__) __unittest = True @@ -242,6 +243,8 @@ """Find available config files""" filenames = cfg_args.config[:] proj_opts = ("unittest.cfg", "nose2.cfg") + if TOML_ENABLED: + proj_opts += ("pyproject.toml",) for fn in proj_opts: if cfg_args.top_level_directory: fn = os.path.abspath(os.path.join(cfg_args.top_level_directory, fn)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/plugins/loader/eggdiscovery.py new/nose2-0.15.1/nose2/plugins/loader/eggdiscovery.py --- old/nose2-0.14.2/nose2/plugins/loader/eggdiscovery.py 2024-04-28 01:10:38.000000000 +0200 +++ new/nose2-0.15.1/nose2/plugins/loader/eggdiscovery.py 2024-06-01 04:04:39.000000000 +0200 @@ -13,6 +13,8 @@ """ +from __future__ import annotations + import logging import os @@ -24,8 +26,10 @@ try: import pkg_resources + + _has_pkg_resources = True except ImportError: - pkg_resources = None + _has_pkg_resources = False class EggDiscoveryLoader(events.Plugin, discovery.Discoverer): @@ -80,7 +84,7 @@ def _find_tests_in_dir(self, event, full_path, top_level): if os.path.exists(full_path): return - elif pkg_resources and full_path.find(".egg") != -1: + elif _has_pkg_resources and full_path.find(".egg") != -1: egg_path = full_path.split(".egg")[0] + ".egg" for dist in pkg_resources.find_distributions(egg_path): for modname in dist._get_metadata("top_level.txt"): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/plugins/printhooks.py new/nose2-0.15.1/nose2/plugins/printhooks.py --- old/nose2-0.14.2/nose2/plugins/printhooks.py 2024-04-28 01:10:38.000000000 +0200 +++ new/nose2-0.15.1/nose2/plugins/printhooks.py 2024-06-01 04:04:39.000000000 +0200 @@ -12,11 +12,13 @@ each call. """ +from __future__ import annotations + import sys from nose2 import events -INDENT = [] +INDENT: list[str] = [] __unittest = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/session.py new/nose2-0.15.1/nose2/session.py --- old/nose2-0.14.2/nose2/session.py 2024-04-28 01:10:38.000000000 +0200 +++ new/nose2-0.15.1/nose2/session.py 2024-06-01 05:18:40.000000000 +0200 @@ -1,11 +1,11 @@ import argparse import logging import os - -# py2/py3 compatible load of SafeConfigParser/ConfigParser +import pathlib from configparser import ConfigParser from nose2 import config, events, util +from nose2._toml import load_toml log = logging.getLogger(__name__) __unittest = True @@ -118,7 +118,24 @@ Loads all names files that exist into ``self.config``. """ - self.config.read(filenames) + for filename in filenames: + path = pathlib.Path(filename) + if not path.exists(): + continue + + # handle pyproject.toml case + if path.name == "pyproject.toml": + toml_config = load_toml(filename) + if not isinstance(toml_config.get("tool"), dict): + continue + tool_table = toml_config["tool"] + if not isinstance(tool_table.get("nose2"), dict): + continue + self.config.read_dict(tool_table["nose2"]) + + # else, use the config parser to read config data + else: + self.config.read(path) def loadPlugins(self, modules=None, exclude=None): """Load plugins. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/_common.py new/nose2-0.15.1/nose2/tests/_common.py --- old/nose2-0.14.2/nose2/tests/_common.py 2024-05-07 16:39:24.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/_common.py 2024-06-01 04:04:39.000000000 +0200 @@ -210,13 +210,13 @@ self.cwd = os.getcwd() if self.chdir: os.chdir(self.chdir) - self.stdout = sys.stdout = sys.__stdout__ = io.StringIO() - self.stderr = sys.stderr = sys.__stderr__ = io.StringIO() + self.stdout = sys.stdout = sys.__stdout__ = io.StringIO() # type: ignore[misc] + self.stderr = sys.stderr = sys.__stderr__ = io.StringIO() # type: ignore[misc] return self def __exit__(self, exc_type, exc_val, exc_tb): - sys.stdout = sys.__stdout__ = self._stdout - sys.stderr = sys.__stderr__ = self._stderr + sys.stdout = sys.__stdout__ = self._stdout # type: ignore[misc] + sys.stderr = sys.__stderr__ = self._stderr # type: ignore[misc] if self.chdir: os.chdir(self.cwd) return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/module_fixtures/test_mf_param_func.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/module_fixtures/test_mf_param_func.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/module_fixtures/test_mf_param_func.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/module_fixtures/test_mf_param_func.py 2024-06-01 04:04:39.000000000 +0200 @@ -14,4 +14,4 @@ assert THINGS, "setup didn't run I think" -test.paramList = (1,) +test.paramList = (1,) # type: ignore[attr-defined] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes/test_classes.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes/test_classes.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes/test_classes.py 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes/test_classes.py 2024-06-01 04:04:39.000000000 +0200 @@ -12,4 +12,4 @@ def test_params(self, a): pass - test_params.paramList = (1, 2) + test_params.paramList = (1, 2) # type: ignore[attr-defined] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes/test_fixtures.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes/test_fixtures.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes/test_fixtures.py 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes/test_fixtures.py 2024-06-01 04:04:39.000000000 +0200 @@ -29,4 +29,4 @@ assert self.test_setup assert self.setup - test_params.paramList = (1, 2) + test_params.paramList = (1, 2) # type: ignore[attr-defined] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes_mp/test_classes_mp.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes_mp/test_classes_mp.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes_mp/test_classes_mp.py 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes_mp/test_classes_mp.py 2024-06-01 04:04:39.000000000 +0200 @@ -12,4 +12,4 @@ def test_params(self, a): pass - test_params.paramList = (1, 2) + test_params.paramList = (1, 2) # type: ignore[attr-defined] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes_mp/test_fixtures_mp.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes_mp/test_fixtures_mp.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/test_classes_mp/test_fixtures_mp.py 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/test_classes_mp/test_fixtures_mp.py 2024-06-01 04:04:39.000000000 +0200 @@ -29,4 +29,4 @@ assert self.test_setup assert self.setup - test_params.paramList = (1, 2) + test_params.paramList = (1, 2) # type: ignore[attr-defined] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/tests_in_package/pkg1/test/test_things.py 2024-06-01 04:04:39.000000000 +0200 @@ -7,65 +7,65 @@ def test_ok(self): pass - test_ok.tags = ["method", "pass"] - test_ok.a = 0 - test_ok.b = 1 + test_ok.tags = ["method", "pass"] # type: ignore[attr-defined] + test_ok.a = 0 # type: ignore[attr-defined] + test_ok.b = 1 # type: ignore[attr-defined] def test_typeerr(self): raise TypeError("oops") - test_typeerr.tags = ["method"] + test_typeerr.tags = ["method"] # type: ignore[attr-defined] def test_failed(self): print("Hello stdout") assert False, "I failed" - test_failed.tags = ["method"] + test_failed.tags = ["method"] # type: ignore[attr-defined] def test_skippy(self): raise unittest.SkipTest("I wanted to skip") - test_skippy.a = 1 - test_skippy.b = 1 + test_skippy.a = 1 # type: ignore[attr-defined] + test_skippy.b = 1 # type: ignore[attr-defined] def test_gen_method(self): def check(x): assert x == 1 - check.b = 2 + check.b = 2 # type: ignore[attr-defined] yield check, 1 yield check, 2 - test_gen_method.a = 1 - test_gen_method.b = 1 + test_gen_method.a = 1 # type: ignore[attr-defined] + test_gen_method.b = 1 # type: ignore[attr-defined] def test_params_method(self, a): self.assertEqual(a, 1) - test_params_method.paramList = (1, 2) - test_params_method.a = 1 + test_params_method.paramList = (1, 2) # type: ignore[attr-defined] + test_params_method.a = 1 # type: ignore[attr-defined] def test_func(): assert 1 == 1 -test_func.a = 1 -test_func.b = 0 -test_func.tags = ["func", "pass"] +test_func.a = 1 # type: ignore[attr-defined] +test_func.b = 0 # type: ignore[attr-defined] +test_func.tags = ["func", "pass"] # type: ignore[attr-defined] def test_gen(): def check(a, b): assert a == b - check.tags = ["func"] + check.tags = ["func"] # type: ignore[attr-defined] for i in range(0, 5): yield check, (i, i) -test_gen.testGenerator = True -test_gen.tags = ["func"] +test_gen.testGenerator = True # type: ignore[attr-defined] +test_gen.tags = ["func"] # type: ignore[attr-defined] def test_gen_nose_style(): @@ -88,19 +88,19 @@ assert did_setup -test_fixt.setup = setup +test_fixt.setup = setup # type: ignore[attr-defined] def test_params_func(a): assert a == 1 -test_params_func.paramList = (1, 2) -test_params_func.tags = ["func"] +test_params_func.paramList = (1, 2) # type: ignore[attr-defined] +test_params_func.tags = ["func"] # type: ignore[attr-defined] def test_params_func_multi_arg(a, b): assert a == b -test_params_func_multi_arg.paramList = ((1, 1), (1, 2), (2, 2)) +test_params_func_multi_arg.paramList = ((1, 1), (1, 2), (2, 2)) # type: ignore[attr-defined] # noqa: E501 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/scenario/tests_in_unzipped_eggs/pkgunegg-0.0.0-py2.7.egg/pkgunegg/test/test_things.py new/nose2-0.15.1/nose2/tests/functional/support/scenario/tests_in_unzipped_eggs/pkgunegg-0.0.0-py2.7.egg/pkgunegg/test/test_things.py --- old/nose2-0.14.2/nose2/tests/functional/support/scenario/tests_in_unzipped_eggs/pkgunegg-0.0.0-py2.7.egg/pkgunegg/test/test_things.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/scenario/tests_in_unzipped_eggs/pkgunegg-0.0.0-py2.7.egg/pkgunegg/test/test_things.py 2024-06-01 04:04:39.000000000 +0200 @@ -7,65 +7,65 @@ def test_ok(self): pass - test_ok.tags = ["method", "pass"] - test_ok.a = 0 - test_ok.b = 1 + test_ok.tags = ["method", "pass"] # type: ignore[attr-defined] + test_ok.a = 0 # type: ignore[attr-defined] + test_ok.b = 1 # type: ignore[attr-defined] def test_typeerr(self): raise TypeError("oops") - test_typeerr.tags = ["method"] + test_typeerr.tags = ["method"] # type: ignore[attr-defined] def test_failed(self): print("Hello stdout") assert False, "I failed" - test_failed.tags = ["method"] + test_failed.tags = ["method"] # type: ignore[attr-defined] def test_skippy(self): raise unittest.SkipTest("I wanted to skip") - test_skippy.a = 1 - test_skippy.b = 1 + test_skippy.a = 1 # type: ignore[attr-defined] + test_skippy.b = 1 # type: ignore[attr-defined] def test_gen_method(self): def check(x): assert x == 1 - check.b = 2 + check.b = 2 # type: ignore[attr-defined] yield check, 1 yield check, 2 - test_gen_method.a = 1 - test_gen_method.b = 1 + test_gen_method.a = 1 # type: ignore[attr-defined] + test_gen_method.b = 1 # type: ignore[attr-defined] def test_params_method(self, a): self.assertEqual(a, 1) - test_params_method.paramList = (1, 2) - test_params_method.a = 1 + test_params_method.paramList = (1, 2) # type: ignore[attr-defined] + test_params_method.a = 1 # type: ignore[attr-defined] def test_func(): assert 1 == 1 -test_func.a = 1 -test_func.b = 0 -test_func.tags = ["func", "pass"] +test_func.a = 1 # type: ignore[attr-defined] +test_func.b = 0 # type: ignore[attr-defined] +test_func.tags = ["func", "pass"] # type: ignore[attr-defined] def test_gen(): def check(a, b): assert a == b - check.tags = ["func"] + check.tags = ["func"] # type: ignore[attr-defined] for i in range(0, 5): yield check, (i, i) -test_gen.testGenerator = True -test_gen.tags = ["func"] +test_gen.testGenerator = True # type: ignore[attr-defined] +test_gen.tags = ["func"] # type: ignore[attr-defined] def test_gen_nose_style(): @@ -88,19 +88,19 @@ assert did_setup -test_fixt.setup = setup +test_fixt.setup = setup # type: ignore[attr-defined] def test_params_func(a): assert a == 1 -test_params_func.paramList = (1, 2) -test_params_func.tags = ["func"] +test_params_func.paramList = (1, 2) # type: ignore[attr-defined] +test_params_func.tags = ["func"] # type: ignore[attr-defined] def test_params_func_multi_arg(a, b): assert a == b -test_params_func_multi_arg.paramList = ((1, 1), (1, 2), (2, 2)) +test_params_func_multi_arg.paramList = ((1, 1), (1, 2), (2, 2)) # type: ignore[attr-defined] # noqa: E501 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/such/test_such.py new/nose2-0.15.1/nose2/tests/functional/support/such/test_such.py --- old/nose2-0.14.2/nose2/tests/functional/support/such/test_such.py 2023-04-29 20:18:18.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/support/such/test_such.py 2024-06-01 04:04:39.000000000 +0200 @@ -51,7 +51,7 @@ # with it.having("an expensive fixture"): - @it.has_setup # noqa: F811 + @it.has_setup def setup(): # noqa: F811 it.things.append(2) @@ -61,7 +61,7 @@ # them. Tests can call any and all TestCase methods on this # instance. # - @it.should("do more things") # noqa: F811 + @it.should("do more things") def test(case): # noqa: F811 case.assertEqual(it.things[-1], 2) @@ -70,15 +70,15 @@ # with it.having("another precondition"): - @it.has_setup # noqa: F811 + @it.has_setup def setup(): # noqa: F811 it.things.append(3) - @it.has_teardown # noqa: F811 + @it.has_teardown def teardown(): # noqa: F811 it.things.pop() - @it.should("do that not this") # noqa: F811 + @it.should("do that not this") # type: ignore[no-redef] def test(case): # noqa: F811 it.things.append(4) # @@ -87,7 +87,7 @@ case.addCleanup(it.things.pop) case.assertEqual(it.things[-1], 4, it.things) - @it.should("do this not that") # noqa: F811 + @it.should("do this not that") # type: ignore[no-redef] def test(case): # noqa: F811 case.assertEqual(it.things[-1], 3, it.things[:]) @@ -104,11 +104,11 @@ # it.uses(SomeLayer) - @it.has_setup # noqa: F811 + @it.has_setup def setup(): # noqa: F811 it.things.append(99) - @it.has_teardown # noqa: F811 + @it.has_teardown def teardown(): # noqa: F811 it.things.pop() @@ -127,24 +127,24 @@ delattr(it, "is_funny") delattr(case, "is_funny") - @it.should("do something else") # noqa: F811 + @it.should("do something else") # type: ignore[no-redef] def test(case): # noqa: F811 assert it.things[-1] == 99 assert it.is_funny assert case.is_funny - @it.should("have another test") # noqa: F811 + @it.should("have another test") # type: ignore[no-redef] def test(case): # noqa: F811 assert it.is_funny assert case.is_funny - @it.should("have access to an external fixture") # noqa: F811 + @it.should("have access to an external fixture") # type: ignore[no-redef] def test(case): # noqa: F811 assert it.somelayer with it.having("a case inside the external fixture"): - @it.should("still have access to that fixture") # noqa: F811 + @it.should("still have access to that fixture") # type: ignore[no-redef] # noqa: E501 def test(case): # noqa: F811 assert it.somelayer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/toml/a/pyproject.toml new/nose2-0.15.1/nose2/tests/functional/support/toml/a/pyproject.toml --- old/nose2-0.14.2/nose2/tests/functional/support/toml/a/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/nose2-0.15.1/nose2/tests/functional/support/toml/a/pyproject.toml 2024-05-31 03:06:08.000000000 +0200 @@ -0,0 +1,5 @@ +[tool.nose2.a] +a = 1 + +[tool.nose2.unittest] +plugins = "plugin_a" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/support/toml/b/pyproject.toml new/nose2-0.15.1/nose2/tests/functional/support/toml/b/pyproject.toml --- old/nose2-0.14.2/nose2/tests/functional/support/toml/b/pyproject.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/nose2-0.15.1/nose2/tests/functional/support/toml/b/pyproject.toml 2024-05-31 03:06:08.000000000 +0200 @@ -0,0 +1,5 @@ +[tool.nose2.b] +b = """ +4 +5 +""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/test_eggdiscovery_loader.py new/nose2-0.15.1/nose2/tests/functional/test_eggdiscovery_loader.py --- old/nose2-0.14.2/nose2/tests/functional/test_eggdiscovery_loader.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/test_eggdiscovery_loader.py 2024-06-01 04:04:39.000000000 +0200 @@ -6,11 +6,9 @@ from nose2.tests._common import FunctionalTestCase, support_file try: - import pkg_resources - + import pkg_resources # noqa: F401 except ImportError: - pkg_resources = None - + pass else: class EggDiscoveryFunctionalTest(FunctionalTestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/test_prettyassert.py new/nose2-0.15.1/nose2/tests/functional/test_prettyassert.py --- old/nose2-0.14.2/nose2/tests/functional/test_prettyassert.py 2024-05-07 16:39:24.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/test_prettyassert.py 2024-05-29 21:47:44.000000000 +0200 @@ -167,7 +167,7 @@ "scenario/pretty_asserts/unittest_assertion", "-v", "--pretty-assert" ) # look for typical unittest output - expected = "self.assertTrue\\(x\\)\nAssertionError: False is not true" + expected = "self.assertTrue\\(x\\)\n(\\W+\n)?AssertionError: False is not true" stderr = self.assertProcOutputPattern(proc, expected) # the assertion line wasn't reprinted by prettyassert self.assertNotIn(">>> self.assertTrue", stderr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/functional/test_session.py new/nose2-0.15.1/nose2/tests/functional/test_session.py --- old/nose2-0.14.2/nose2/tests/functional/test_session.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/functional/test_session.py 2024-06-01 05:18:40.000000000 +0200 @@ -1,9 +1,32 @@ +import pathlib import sys +import tempfile +import unittest from nose2 import session +from nose2._toml import TOML_ENABLED from nose2.tests._common import FunctionalTestCase, support_file +def test_loading_config_from_ini_file_without_cfg_suffix(): + """ + Regression test for https://github.com/nose-devs/nose2/issues/614 + + It is possible to have nose2 config embedded in any ini config file, and it might + not have a recognizable name. + It is not guaranteed that filenames used for config will end in `.cfg`. + """ + sess = session.Session() + with tempfile.TemporaryDirectory() as tmpdirname: + tmpdir = pathlib.Path(tmpdirname) + + foo_ini = tmpdir / "foo.ini" + foo_ini.write_text("""[alpha]\na = 1""") + + sess.loadConfigFiles(str(foo_ini)) + assert sess.config.has_section("alpha") + + class SessionFunctionalTests(FunctionalTestCase): def setUp(self): self.s = session.Session() @@ -41,6 +64,58 @@ # Hack cached Config object internals to make the stored value # something different cache_sess.configCache["a"]._mvd["a"] = "0" + newitems = [] + for item in cache_sess.configCache["a"]._items: + if item != ("a", "1"): + newitems.append(item) + else: + newitems.append(("a", "0")) + cache_sess.configCache["a"]._items = newitems + + # Second access to given section, confirm returns cached value + # rather than parsing config file again + secondaccess = cache_sess.get("a") + assert secondaccess.as_int("a") == 0 + + +class SessionTomlFunctionalTests(FunctionalTestCase): + def setUp(self): + if not TOML_ENABLED: + raise unittest.SkipTest("toml module not available") + self.s = session.Session() + self.s.loadConfigFiles( + support_file("toml", "a", "pyproject.toml"), + support_file("toml", "b", "pyproject.toml"), + ) + + def test_session_can_load_config_files(self): + assert self.s.config.has_section("a") + assert self.s.config.has_section("b") + + def test_session_holds_plugin_config(self): + plug_config = self.s.get("a") + assert plug_config + + def test_session_can_load_toml_plugins_from_modules(self): + self.s.loadPlugins() + assert self.s.plugins + plug = self.s.plugins[0] + self.assertEqual(plug.a, 1) + + def test_session_config_cacheing(self): + """Test caching of config sections works""" + + # Create new session (generic one likely already cached + # depending on test order) + cache_sess = session.Session() + cache_sess.loadConfigFiles(support_file("toml", "a", "pyproject.toml")) + + # First access to given section, should read from config file + firstaccess = cache_sess.get("a") + assert firstaccess.as_int("a") == 1 + # Hack cached Config object internals to make the stored value + # something different + cache_sess.configCache["a"]._mvd["a"] = "0" newitems = [] for item in cache_sess.configCache["a"]._items: if item != ("a", "1"): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2/tests/unit/test_prof_plugin.py new/nose2-0.15.1/nose2/tests/unit/test_prof_plugin.py --- old/nose2-0.14.2/nose2/tests/unit/test_prof_plugin.py 2023-04-25 23:28:20.000000000 +0200 +++ new/nose2-0.15.1/nose2/tests/unit/test_prof_plugin.py 2024-06-01 04:04:39.000000000 +0200 @@ -22,7 +22,11 @@ def test_startTestRun_sets_executeTests(self): _prof = Stub() _prof.runcall = object() - prof.cProfile.Profile = lambda: _prof + + def _profile_call() -> Stub: + return _prof + + prof.cProfile.Profile = _profile_call event = StartTestRunEvent( runner=None, suite=None, result=None, startTime=None, executeTests=None ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2.egg-info/PKG-INFO new/nose2-0.15.1/nose2.egg-info/PKG-INFO --- old/nose2-0.14.2/nose2.egg-info/PKG-INFO 2024-05-07 16:49:53.000000000 +0200 +++ new/nose2-0.15.1/nose2.egg-info/PKG-INFO 2024-06-01 05:20:00.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nose2 -Version: 0.14.2 +Version: 0.15.1 Summary: unittest with plugins Author-email: Stephen Rosen <dev@nose2.io> License: BSD-2-Clause @@ -32,9 +32,9 @@ Provides-Extra: coverage-plugin Requires-Dist: coverage; extra == "coverage-plugin" Provides-Extra: dev -Requires-Dist: Sphinx; extra == "dev" +Requires-Dist: sphinx; extra == "dev" Requires-Dist: sphinx-issues; extra == "dev" -Requires-Dist: sphinx_rtd_theme; extra == "dev" +Requires-Dist: sphinx-rtd-theme; extra == "dev" .. image:: https://results.pre-commit.ci/badge/github/nose-devs/nose2/main.svg :target: https://results.pre-commit.ci/latest/github/nose-devs/nose2/main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2.egg-info/SOURCES.txt new/nose2-0.15.1/nose2.egg-info/SOURCES.txt --- old/nose2-0.14.2/nose2.egg-info/SOURCES.txt 2024-05-07 16:49:53.000000000 +0200 +++ new/nose2-0.15.1/nose2.egg-info/SOURCES.txt 2024-06-01 05:20:00.000000000 +0200 @@ -63,6 +63,7 @@ docs/plugins/testid.rst nose2/__init__.py nose2/__main__.py +nose2/_toml.py nose2/collector.py nose2/config.py nose2/events.py @@ -297,6 +298,8 @@ nose2/tests/functional/support/such/test_such.py nose2/tests/functional/support/such/test_such_timing.py nose2/tests/functional/support/such/test_such_without_layers.py +nose2/tests/functional/support/toml/a/pyproject.toml +nose2/tests/functional/support/toml/b/pyproject.toml nose2/tests/unit/__init__.py nose2/tests/unit/test_attrib_plugin.py nose2/tests/unit/test_buffer_plugin.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/nose2.egg-info/requires.txt new/nose2-0.15.1/nose2.egg-info/requires.txt --- old/nose2-0.14.2/nose2.egg-info/requires.txt 2024-05-07 16:49:53.000000000 +0200 +++ new/nose2-0.15.1/nose2.egg-info/requires.txt 2024-06-01 05:20:00.000000000 +0200 @@ -3,6 +3,6 @@ coverage [dev] -Sphinx +sphinx sphinx-issues -sphinx_rtd_theme +sphinx-rtd-theme diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/pyproject.toml new/nose2-0.15.1/pyproject.toml --- old/nose2-0.14.2/pyproject.toml 2024-04-28 01:10:38.000000000 +0200 +++ new/nose2-0.15.1/pyproject.toml 2024-06-01 04:04:39.000000000 +0200 @@ -8,17 +8,17 @@ name = "nose2" description = "unittest with plugins" readme = "README.rst" -keywords= [ +keywords = [ "testing", "tests", "unittest", ] -license = {text = "BSD-2-Clause"} +license = { text = "BSD-2-Clause" } authors = [ { name = "Stephen Rosen", email = "dev@nose2.io" }, ] requires-python = ">=3.8" -classifiers=[ +classifiers = [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", @@ -40,25 +40,34 @@ dynamic = [ "version", ] -[project.optional-dependencies] -coverage_plugin = [ +optional-dependencies.coverage_plugin = [ "coverage", ] -dev = [ - "Sphinx", +optional-dependencies.dev = [ + "sphinx", "sphinx-issues", - "sphinx_rtd_theme", + "sphinx-rtd-theme", ] -[project.urls] -changelog = "https://docs.nose2.io/en/latest/changelog.html" -documentation = "https://docs.nose2.io/" -repository = "https://github.com/nose-devs/nose2" -[project.scripts] -nose2 = "nose2:discover" +urls.changelog = "https://docs.nose2.io/en/latest/changelog.html" +urls.documentation = "https://docs.nose2.io/" +urls.repository = "https://github.com/nose-devs/nose2" +scripts.nose2 = "nose2:discover" [tool.setuptools.dynamic] -version = {attr = "nose2.__version__"} +version = { attr = "nose2.__version__" } [tool.isort] profile = "black" -known_third_party = ["coverage", "mock"] +known_third_party = [ + "coverage", + "mock", +] + +[tool.mypy] +# strict = true +sqlite_cache = true +ignore_missing_imports = true +disallow_subclassing_any = false +files = [ + "nose2", +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nose2-0.14.2/tox.ini new/nose2-0.15.1/tox.ini --- old/nose2-0.14.2/tox.ini 2023-08-30 03:22:49.000000000 +0200 +++ new/nose2-0.15.1/tox.ini 2024-06-01 05:18:36.000000000 +0200 @@ -1,10 +1,12 @@ [tox] -envlist=py{38,39,310,311,312}{,-nocov},pypy,docs,lint +envlist=py{38,39,310,311,312,313}{,-nocov},pypy,docs,lint [testenv] passenv = CI extras = dev -deps = !nocov: coverage +deps = + !nocov: coverage + py{38,39,310}-toml: tomli setenv = PYTHONPATH={toxinidir} commands = nocov: nose2 -v --pretty-assert {posargs} @@ -20,9 +22,11 @@ [testenv:mypy] extras = dev deps = - mypy + mypy==1.10.0 types-setuptools types-docutils + tomli + coverage commands = mypy nose2/ {posargs}
participants (1)
-
Source-Sync