2.2.4: pytest fails in few units
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
- because I'm calling
build
with--no-isolation
I'm using during all processes only locally installed modules - install .whl file in </install/prefix> using 'installer` module
- run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
- build is performed in env which is
cut off from access to the public network
(pytest is executed with-m "not network"
)
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-colored-2.2.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-colored-2.2.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.4, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/colored-2.2.4
collected 13 items
unittests/test_background.py .FF.. [ 38%]
unittests/test_foreground.py .FF.. [ 76%]
unittests/test_styles.py FF. [100%]
========================================================================================= FAILURES ==========================================================================================
__________________________________________________________________________ TestBackground.test_background_256_code __________________________________________________________________________
self = <test_background.TestBackground testMethod=test_background_256_code>
def test_background_256_code(self):
for code in Library.COLORS.values():
color = Colored(code)
> self.assertEqual(f'{self.BACKGROUND_256}{code}{self.END}', color.background())
E AssertionError: '\x1b[48;5;0m' != ''
E -
E +
unittests/test_background.py:19: AssertionError
__________________________________________________________________________ TestBackground.test_background_256_name __________________________________________________________________________
self = <test_background.TestBackground testMethod=test_background_256_name>
def test_background_256_name(self):
for name, code in Library.COLORS.items():
color = Colored(name)
> self.assertEqual(f'{self.BACKGROUND_256}{code}{self.END}', color.background())
E AssertionError: '\x1b[48;5;0m' != ''
E -
E +
unittests/test_background.py:24: AssertionError
__________________________________________________________________________ TestForeground.test_foreground_256_code __________________________________________________________________________
self = <test_foreground.TestForeground testMethod=test_foreground_256_code>
def test_foreground_256_code(self):
for code in Library.COLORS.values():
color = Colored(code)
> self.assertEqual(f'{self.FOREGROUND_256}{code}{self.END}', color.foreground())
E AssertionError: '\x1b[38;5;0m' != ''
E -
E +
unittests/test_foreground.py:19: AssertionError
__________________________________________________________________________ TestForeground.test_foreground_256_name __________________________________________________________________________
self = <test_foreground.TestForeground testMethod=test_foreground_256_name>
def test_foreground_256_name(self):
for name, code in Library.COLORS.items():
color = Colored(name)
> self.assertEqual(f'{self.FOREGROUND_256}{code}{self.END}', color.foreground())
E AssertionError: '\x1b[38;5;0m' != ''
E -
E +
unittests/test_foreground.py:24: AssertionError
________________________________________________________________________________ TestStyles.test_style_code _________________________________________________________________________________
self = <test_styles.TestStyles testMethod=test_style_code>
def test_style_code(self):
for code in Library.STYLES.values():
style = Colored(code)
> self.assertEqual(f'{self.ESC}{code}{self.END}', style.attribute())
E AssertionError: '\x1b[1m' != ''
E -
E +
unittests/test_styles.py:17: AssertionError
________________________________________________________________________________ TestStyles.test_style_name _________________________________________________________________________________
self = <test_styles.TestStyles testMethod=test_style_name>
def test_style_name(self):
for name, code in Library.STYLES.items():
style = Colored(name)
> self.assertEqual(f'{self.ESC}{code}{self.END}', style.attribute())
E AssertionError: '\x1b[1m' != ''
E -
E +
unittests/test_styles.py:22: AssertionError
================================================================================== short test summary info ==================================================================================
FAILED unittests/test_background.py::TestBackground::test_background_256_code - AssertionError: '\x1b[48;5;0m' != ''
FAILED unittests/test_background.py::TestBackground::test_background_256_name - AssertionError: '\x1b[48;5;0m' != ''
FAILED unittests/test_foreground.py::TestForeground::test_foreground_256_code - AssertionError: '\x1b[38;5;0m' != ''
FAILED unittests/test_foreground.py::TestForeground::test_foreground_256_name - AssertionError: '\x1b[38;5;0m' != ''
FAILED unittests/test_styles.py::TestStyles::test_style_code - AssertionError: '\x1b[1m' != ''
FAILED unittests/test_styles.py::TestStyles::test_style_name - AssertionError: '\x1b[1m' != ''
================================================================================ 6 failed, 7 passed in 0.17s ================================================================================
List of installed modules in build env:
Package Version
----------------------------- -------
alabaster 0.7.13
Babel 2.14.0
build 1.0.3
charset-normalizer 3.3.2
cppclean 0.13
distro 1.8.0
dnf 4.18.2
docutils 0.20.1
exceptiongroup 1.1.3
gpg 1.23.2
idna 3.6
imagesize 1.4.1
importlib-metadata 7.0.1
iniconfig 2.0.0
installer 0.7.0
Jinja2 3.1.2
libdnf 0.72.0
MarkupSafe 2.1.3
packaging 23.2
pluggy 1.3.0
Pygments 2.17.2
pyproject_hooks 1.0.0
pytest 7.4.4
python-dateutil 2.8.2
pytz 2023.3
requests 2.31.0
six 1.16.0
snowballstemmer 2.2.0
Sphinx 7.1.2
sphinxcontrib-applehelp 1.0.4
sphinxcontrib-devhelp 1.0.5
sphinxcontrib-htmlhelp 2.0.4
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.9
tomli 2.0.1
urllib3 1.26.18
wheel 0.42.0
zipp 3.17.0
Please let me know if you need more details or want me to perform some diagnostics.