HansBug / hbutils

Some useful functions and classes in Python infrastructure development
https://hansbug.github.io/hbutils/
Apache License 2.0
10 stars 2 forks source link

python_version()'s unittest will fail when setuptools<50 #69

Open HansBug opened 2 years ago

HansBug commented 2 years ago

When setuptools==49.0.0

test/system/python/test_implementation.py::TestSystemPythonImplementation::test_is_cpython PASSED
test/system/python/test_package.py::TestSystemPythonPackage::test_package_version PASSED
test/system/python/test_version.py::TestSystemPythonVersion::test_python_version FAILED

================================================================================================ FAILURES =================================================================================================
_______________________________________________________________________________ TestSystemPythonVersion.test_python_version _______________________________________________________________________________

self = <test.system.python.test_version.TestSystemPythonVersion object at 0x7fcb3ec47f50>

    def test_python_version(self):
        _actual_version = sys.version_info
        _get_version = python_version()
        assert isinstance(_get_version, _Version)
>       assert _get_version.major == _actual_version.major
E       AttributeError: 'Version' object has no attribute 'major'

test/system/python/test_version.py:17: AttributeError

----------- coverage: platform linux, python 3.7.6-final-0 -----------
Name                                      Stmts   Miss  Cover   Missing
-----------------------------------------------------------------------
hbutils/system/python/__init__.py             3      0   100%
hbutils/system/python/implementation.py      23      0   100%
hbutils/system/python/package.py             10      0   100%
hbutils/system/python/version.py              6      0   100%
-----------------------------------------------------------------------
TOTAL                                        42      0   100%
Coverage XML written to file coverage.xml

========================================================================================= short test summary info =========================================================================================
FAILED test/system/python/test_version.py::TestSystemPythonVersion::test_python_version - AttributeError: 'Version' object has no attribute 'major'

When setuptools is 50 or higher version, this problem disappeared.