Marcel Telka
2023-08-14 d2275febeab3382666415990a1698d0a2b57fd9a
Add pytest-relaxed Python project

7 files added
465 ■■■■■ changed files
components/python/pytest-relaxed/Makefile 44 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/manifests/sample-manifest.p5m 47 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/patches/01-test-disable-pytest-plugins.patch 210 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/pkg5 12 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/pytest-relaxed-PYVER.p5m 47 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/python-integrate-project.conf 26 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/test/results-all.master 79 ●●●●● patch | view | raw | blame | history
components/python/pytest-relaxed/Makefile
New file
@@ -0,0 +1,44 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# This file was automatically generated using the following command:
#   $WS_TOOLS/python-integrate-project pytest-relaxed
#
BUILD_STYLE = setup.py
include ../../../make-rules/shared-macros.mk
COMPONENT_NAME =        pytest-relaxed
HUMAN_VERSION =            2.0.1
COMPONENT_SUMMARY =        pytest-relaxed - Relaxed test discovery/organization for pytest
COMPONENT_PROJECT_URL =        https://pytest-relaxed.readthedocs.io/
COMPONENT_ARCHIVE_URL =        \
    https://github.com/bitprophet/pytest-relaxed/archive/refs/tags/$(HUMAN_VERSION).tar.gz
COMPONENT_ARCHIVE_HASH =    \
    sha256:caf4a7da34e922c0cd26fbf37b9aca1bc099a02668bcf83ebf6fe6717687e844
COMPONENT_LICENSE =        BSD-2-Clause
COMPONENT_LICENSE_FILE =    LICENSE
TEST_STYLE = pytest
include $(WS_MAKE_RULES)/common.mk
# Disable some plugins to get tests passed
PYTEST_ADDOPTS += -p no:black
PYTEST_ADDOPTS += -p no:mypy
PYTEST_ADDOPTS += -p no:randomly
# Auto-generated dependencies
PYTHON_REQUIRED_PACKAGES += library/python/decorator
PYTHON_REQUIRED_PACKAGES += library/python/pytest
PYTHON_REQUIRED_PACKAGES += runtime/python
components/python/pytest-relaxed/manifests/sample-manifest.p5m
New file
@@ -0,0 +1,47 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2023 <contributor>
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)-$(PYV)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/PKG-INFO
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/SOURCES.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/dependency_links.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/entry_points.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/requires.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/top_level.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/__init__.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/_version.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/classes.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/fixtures.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/plugin.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/raises.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/reporter.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/trap.py
# python modules are unusable without python runtime binary
depend type=require fmri=__TBD pkg.debug.depend.file=python$(PYVER) \
    pkg.debug.depend.path=usr/bin
# Automatically generated dependencies based on distribution metadata
depend type=require fmri=pkg:/library/python/decorator-$(PYV)
depend type=require fmri=pkg:/library/python/pytest-$(PYV)
components/python/pytest-relaxed/patches/01-test-disable-pytest-plugins.patch
New file
@@ -0,0 +1,210 @@
Some pytest plugins needs to be disabled because they produce unexpected output.
--- pytest-relaxed-2.0.1/tests/test_collection.py.orig
+++ pytest-relaxed-2.0.1/tests/test_collection.py
@@ -41,7 +41,7 @@
         """
         )
         # TODO: why Result.str() and not str(Result)? Seems unPythonic
-        stdout = testdir.runpytest().stdout.str()
+        stdout = testdir.runpytest("-p", "no:cov", "-p", "no:black").stdout.str()
         assert "hastests.py" in stdout
         assert "_util.py" not in stdout
@@ -80,7 +80,7 @@
                 pass
         """
         )
-        stdout = testdir.runpytest().stdout.str()
+        stdout = testdir.runpytest("-p", "no:cov", "-p", "no:black", "-p", "no:mypy").stdout.str()
         assert "actual_tests.py" in stdout
         assert "conftest.py" not in stdout
@@ -118,7 +118,7 @@
                     pass
         """
         )
-        stdout = testdir.runpytest("-v").stdout.str()
+        stdout = testdir.runpytest("-v", "-p", "no:black").stdout.str()
         for substring in (
             "hello how are you",
             "please test me thx",
@@ -192,7 +192,7 @@
                 pass
         """
         )
-        stdout = testdir.runpytest("-v").stdout.str()
+        stdout = testdir.runpytest("-v", "-p", "no:black").stdout.str()
         assert "actual test here" in stdout
         # will be in stdout as a failure and warning if bug present
         assert "pls_noload" not in stdout
@@ -216,7 +216,7 @@
                         assert self.some_attr == 17
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_setup_method_given_inner_class_instances(self, testdir):
         testdir.makepyfile(
@@ -230,7 +230,7 @@
                         assert self.some_attr == 17
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
 class TestSpecModule:
@@ -243,7 +243,7 @@
                 pass
         """
         )
-        stdout = testdir.runpytest("-v").stdout.str()
+        stdout = testdir.runpytest("-v", "-p", "no:black").stdout.str()
         assert "some_uncallable" not in stdout
     def test_skips_imported_objects(self, testdir):
@@ -267,7 +267,7 @@
                 pass
         """
         )
-        stdout = testdir.runpytest("-v").stdout.str()
+        stdout = testdir.runpytest("-v", "-p", "no:black").stdout.str()
         assert "a test is me" in stdout
         assert "helper" not in stdout
         assert "Helper" not in stdout
@@ -342,7 +342,7 @@
                     pass
         """
         )
-        stdout = testdir.runpytest("-v").stdout.str()
+        stdout = testdir.runpytest("-v", "-p", "no:black", "-p", "no:mypy").stdout.str()
         expected = """
 MyStuff
@@ -381,7 +381,7 @@
         # TODO: first thought was "why is this not automatic?", then realized
         # "duh, it'd be annoying if you wanted to test failure related behavior
         # a lot"...but still want some slightly nicer helper I think
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_nested_self_objects_exhibit_parent_attributes(self, testdir):
         # TODO: really starting to think going back to 'real' fixture files
@@ -398,7 +398,7 @@
                         assert self.an_attr == 5
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_nesting_is_infinite(self, testdir):
         testdir.makepyfile(
@@ -414,7 +414,7 @@
                                 assert self.an_attr == 5
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_overriding_works_naturally(self, testdir):
         testdir.makepyfile(
@@ -429,7 +429,7 @@
                         assert self.an_attr == 7
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_normal_methods_from_outer_classes_are_not_copied(self, testdir):
         testdir.makepyfile(
@@ -443,7 +443,7 @@
                         assert not hasattr(self, 'outer_test')
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_private_methods_from_outer_classes_are_copied(self, testdir):
         testdir.makepyfile(
@@ -461,7 +461,7 @@
                         assert hasattr(self, '_outer_helper')
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
     def test_module_contents_are_not_copied_into_top_level_classes(
         self, testdir
@@ -475,4 +475,4 @@
                     assert not hasattr(self, 'module_constant')
         """
         )
-        assert testdir.runpytest().ret is ExitCode.OK
+        assert testdir.runpytest("-p", "no:black").ret is ExitCode.OK
--- pytest-relaxed-2.0.1/tests/test_display.py.orig
+++ pytest-relaxed-2.0.1/tests/test_display.py
@@ -10,7 +10,7 @@
 def _expect_regular_output(testdir):
-    output = testdir.runpytest().stdout.str()
+    output = testdir.runpytest("-p", "no:black", "-p", "no:mypy", "-p", "no:randomly").stdout.str()
     # Regular results w/ status letters
     assert "behaviors.py .." in output
     assert "other_behaviors.py s.F." in output
@@ -77,7 +77,7 @@
 some things
 other things
 """.lstrip()
-        output = testdir.runpytest_subprocess("-v").stdout.str()
+        output = testdir.runpytest_subprocess("-v", "-p", "no:black", "-p", "no:randomly").stdout.str()
         assert expected in output
@@ -147,7 +147,7 @@
                         assert False
             """,
         )
-        output = testdir.runpytest_subprocess("-v").stdout.str()
+        output = testdir.runpytest_subprocess("-v", "-p", "no:black", "-p", "no:mypy", "-p", "no:randomly").stdout.str()
         results = """
 Behaviors
@@ -200,7 +200,7 @@
                         assert False
             """,
         )
-        output = testdir.runpytest_subprocess("-v").stdout.str()
+        output = testdir.runpytest_subprocess("-v", "-p", "no:black", "-p", "no:mypy", "-p", "no:randomly").stdout.str()
         results = """
 Behaviors
@@ -272,7 +272,7 @@
             yup
             still works
 """.lstrip()
-        assert expected in testdir.runpytest("-v").stdout.str()
+        assert expected in testdir.runpytest("-v", "-p", "no:black", "-p", "no:randomly").stdout.str()
     def test_headers_and_tests_have_underscores_turn_to_spaces(self, testdir):
         testdir.makepyfile(
@@ -303,7 +303,7 @@
     the stuff
 """.lstrip()
-        assert expected in testdir.runpytest("-v").stdout.str()
+        assert expected in testdir.runpytest("-v", "-p", "no:black", "-p", "no:mypy").stdout.str()
     def test_test_suffixes_are_stripped(self, testdir):
         testdir.makepyfile(
@@ -319,7 +319,7 @@
     yup
 """.lstrip()
-        assert expected in testdir.runpytest("-v").stdout.str()
+        assert expected in testdir.runpytest("-v", "-p", "no:black", "-p", "no:mypy").stdout.str()
 class TestNormalMixed:
components/python/pytest-relaxed/pkg5
New file
@@ -0,0 +1,12 @@
{
    "dependencies": [
        "library/python/decorator-39",
        "library/python/pytest-39",
        "runtime/python-39"
    ],
    "fmris": [
        "library/python/pytest-relaxed-39",
        "library/python/pytest-relaxed"
    ],
    "name": "pytest-relaxed"
}
components/python/pytest-relaxed/pytest-relaxed-PYVER.p5m
New file
@@ -0,0 +1,47 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# This file was automatically generated using python-integrate-project
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)-$(PYV)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/PKG-INFO
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/SOURCES.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/dependency_links.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/entry_points.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/requires.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed-$(HUMAN_VERSION)-py$(PYVER).egg-info/top_level.txt
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/__init__.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/_version.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/classes.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/fixtures.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/plugin.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/raises.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/reporter.py
file path=usr/lib/python$(PYVER)/vendor-packages/pytest_relaxed/trap.py
# python modules are unusable without python runtime binary
depend type=require fmri=__TBD pkg.debug.depend.file=python$(PYVER) \
    pkg.debug.depend.path=usr/bin
# Automatically generated dependencies based on distribution metadata
depend type=require fmri=pkg:/library/python/decorator-$(PYV)
depend type=require fmri=pkg:/library/python/pytest-$(PYV)
components/python/pytest-relaxed/python-integrate-project.conf
New file
@@ -0,0 +1,26 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2023 Marcel Telka
#
%patch% 01-test-disable-pytest-plugins.patch
%hook-begin%
# https://github.com/bitprophet/pytest-relaxed/issues/27
DOWNLOAD_URL='https://github.com/bitprophet/pytest-relaxed/archive/refs/tags/$(HUMAN_VERSION).tar.gz'
%include-3%
# Disable some plugins to get tests passed
PYTEST_ADDOPTS += -p no:black
PYTEST_ADDOPTS += -p no:mypy
PYTEST_ADDOPTS += -p no:randomly
components/python/pytest-relaxed/test/results-all.master
New file
@@ -0,0 +1,79 @@
============================= test session starts ==============================
platform sunos5 -- Python $(PYTHON_VERSION).X -- $(PYTHON)
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('$(@D)/.hypothesis/examples')
rootdir: $(@D)
configfile: pytest.ini
testpaths: tests
asyncio: mode=strict
collecting ... collected 34 items
 pytest collect file
    only loads dot py files
    skips underscored files
    skips underscored directories
    does not consume conftest files
RelaxedMixin
    selects all non underscored members
    skips setup and teardown
    skips pytest fixtures
    setup given inner class instances when inherited
    setup method given inner class instances
SpecModule
    skips non callable items
    skips imported objects
    does not warn about imported names
    replaces class tests with custom recursing classes
    does not collect test prefixed files
SpecClass
    methods self objects exhibit class attributes
    nested self objects exhibit parent attributes
    nesting is infinite
    overriding works naturally
    normal methods from outer classes are not copied
    private methods from outer classes are copied
    module contents are not copied into top level classes
RegularFunctions
    acts just like normal pytest
VerboseFunctions
    displays tests indented under module header
    test prefixes are stripped
VerboseClasses
    shows tests nested under classes without files
    tests are colorized by test result
    nests many levels deep no problem
    headers and tests have underscores turn to spaces
    test prefixes are stripped
    test suffixes are stripped
 raises
    when given exception raised no problem
    when given exception not raised it raises Exception
    when some other exception raised it is untouched
=============================== warnings summary ===============================
tests/test_collection.py: 21 warnings
tests/test_display.py: 5 warnings
  $(@D)/pytest_relaxed/plugin.py:40: PytestDeprecationWarning: The hookimpl pytest_configure uses old-style configuration options (marks or attributes).
  Please use the pytest.hookimpl(trylast=True) decorator instead
   to configure the hooks.
   See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
    @pytest.mark.trylast  # So we can be sure builtin terminalreporter exists
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======== 32 passed, 2 skipped, 26 warnings ========