Skip to content

incorrect logic in test__test_environ_pythonpath_no_arg #7366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bnavigator opened this issue Aug 27, 2022 · 0 comments · Fixed by #7367
Closed

incorrect logic in test__test_environ_pythonpath_no_arg #7366

bnavigator opened this issue Aug 27, 2022 · 0 comments · Fixed by #7367
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow

Comments

@bnavigator
Copy link
Contributor

test__test_environ_pythonpath_no_arg expects an unchanged PYTHONPATH. But that is not what the decorator does:

https://github.com/PyCQA/pylint/blob/ccd1dc8d5d1bc705b0b5eb4183ba979f97a96f21/tests/testutils/test_testutils_utils.py#L53-L60

https://github.com/PyCQA/pylint/blob/ccd1dc8d5d1bc705b0b5eb4183ba979f97a96f21/pylint/testutils/utils.py#L54-L62

The test fails, when the test suite is run with a set PYTHONPATH:

[  111s] =================================== FAILURES ===================================
[  111s] _____________________ test__test_environ_pythonpath_no_arg _____________________
[  111s] 
[  111s]     def test__test_environ_pythonpath_no_arg() -> None:
[  111s]         python_path = os.environ.get("PYTHONPATH")
[  111s]         with _test_environ_pythonpath():
[  111s] >           assert os.environ.get("PYTHONPATH") == python_path
[  111s] E           AssertionError: assert None == '/home/abuild/rpmbuild/BUILDROOT/python-pylint-2.15.0-0.x86_64/usr/lib/python3.8/site-packages'
[  111s] E            +  where None = <bound method Mapping.get of environ({'PYTHONDONTWRITEBYTECODE': '1', 'SHELL': '/bin/bash', 'RPM_SOURCE_DIR': '/home/abuild/rpmbuild/SOURCES', 'XDG_CONFIG_DIRS': '/etc/xdg:/usr/etc/xdg', 'LESS': '-M -I -R', 'MACHTYPE': 'x86_64-suse-linux', 'PKG_CONFIG_PATH': ':/usr/lib64/pkgconfig:/usr/share/pkgconfig', 'HISTSIZE': '1000', 'HOSTNAME': 'skylab', 'MINICOM': '-c on', 'PYTHONHASHSEED': '0', 'CPU': 'x86_64', 'XDG_CONFIG_HOME': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/xdgflavorconfig', 'GPG_TTY': 'not a tty', 'PWD': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0', 'SOURCE_DATE_EPOCH': '1661558400', 'LOGNAME': 'abuild', 'SUSE_ZNOW': '1', 'RPM_ARCH': 'x86_64', 'XKEYSYMDB': '/usr/X11R6/lib/X11/XKeysymDB', 'XNLSPATH': '/usr/X11R6/lib/X11/nls', 'HOME': '/home/abuild', 'LANG': 'C', 'OSTYPE': 'linux', 'LESS_ADVANCED_PREPROCESSOR': 'no', 'RPM_PACKAGE_RELEASE': '0', 'PERL_HASH_SEED': '42', 'RPM_OS': 'linux', 'SUSE_IGNORED_RPATHS': '/etc/suse-ignored-rpaths.conf', 'MALLOC_PERTURB_': '69', 'LESSCLOSE': 'lessclose.sh %s %s', 'TERM': 'xterm-256color', 'HOST': 'skylab', 'LESSOPEN': 'lessopen.sh %s', 'USER': 'abuild', 'SUSE_ASNEEDED': '1', 'MORE': '-sl', 'CSHEDIT': 'emacs', 'SHLVL': '1', 'RPM_BUILD_DIR': '/home/abuild/rpmbuild/BUILD', 'WINDOWMANAGER': 'xterm', 'PAGER': 'less', 'MALLOC_CHECK_': '3', 'FORCE_SOURCE_DATE': '1', 'RPM_OPT_FLAGS': '-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g', 'RPM_DOC_DIR': '/usr/share/doc/packages', 'QT_HASH_SEED': '0', 'RPM_PACKAGE_VERSION': '2.15.0', 'LC_ALL': 'en_US.UTF-8', 'XDG_DATA_DIRS': '/usr/share', 'VENDOR': 'suse', 'PATH': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin', 'PROFILEREAD': 'true', 'MAIL': '/var/mail/abuild', 'HOSTTYPE': 'x86_64', 'RPM_BUILD_NCPUS': '12', 'RPM_PACKAGE_NAME': 'python-pylint', 'LESSKEY': '/usr/etc/lesskey.bin', 'RPM_BUILD_ROOT': '/home/abuild/rpmbuild/BUILDROOT/python-pylint-2.15.0-0.x86_64', 'OLDPWD': '/home/abuild/rpmbuild/BUILD', '_': '/usr/bin/pytest-3.8', 'tmp_path_env': '/tmp/pytest-of-abuild/pytest-356/test_can_read_toml_env_variabl0/pyproject.toml', 'PYTEST_CURRENT_TEST': 'tests/testutils/test_testutils_utils.py::test__test_environ_pythonpath_no_arg (call)'})>('PYTHONPATH')
[  111s] E            +    where <bound method Mapping.get of environ({'PYTHONDONTWRITEBYTECODE': '1', 'SHELL': '/bin/bash', 'RPM_SOURCE_DIR': '/home/abuild/rpmbuild/SOURCES', 'XDG_CONFIG_DIRS': '/etc/xdg:/usr/etc/xdg', 'LESS': '-M -I -R', 'MACHTYPE': 'x86_64-suse-linux', 'PKG_CONFIG_PATH': ':/usr/lib64/pkgconfig:/usr/share/pkgconfig', 'HISTSIZE': '1000', 'HOSTNAME': 'skylab', 'MINICOM': '-c on', 'PYTHONHASHSEED': '0', 'CPU': 'x86_64', 'XDG_CONFIG_HOME': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/xdgflavorconfig', 'GPG_TTY': 'not a tty', 'PWD': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0', 'SOURCE_DATE_EPOCH': '1661558400', 'LOGNAME': 'abuild', 'SUSE_ZNOW': '1', 'RPM_ARCH': 'x86_64', 'XKEYSYMDB': '/usr/X11R6/lib/X11/XKeysymDB', 'XNLSPATH': '/usr/X11R6/lib/X11/nls', 'HOME': '/home/abuild', 'LANG': 'C', 'OSTYPE': 'linux', 'LESS_ADVANCED_PREPROCESSOR': 'no', 'RPM_PACKAGE_RELEASE': '0', 'PERL_HASH_SEED': '42', 'RPM_OS': 'linux', 'SUSE_IGNORED_RPATHS': '/etc/suse-ignored-rpaths.conf', 'MALLOC_PERTURB_': '69', 'LESSCLOSE': 'lessclose.sh %s %s', 'TERM': 'xterm-256color', 'HOST': 'skylab', 'LESSOPEN': 'lessopen.sh %s', 'USER': 'abuild', 'SUSE_ASNEEDED': '1', 'MORE': '-sl', 'CSHEDIT': 'emacs', 'SHLVL': '1', 'RPM_BUILD_DIR': '/home/abuild/rpmbuild/BUILD', 'WINDOWMANAGER': 'xterm', 'PAGER': 'less', 'MALLOC_CHECK_': '3', 'FORCE_SOURCE_DATE': '1', 'RPM_OPT_FLAGS': '-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g', 'RPM_DOC_DIR': '/usr/share/doc/packages', 'QT_HASH_SEED': '0', 'RPM_PACKAGE_VERSION': '2.15.0', 'LC_ALL': 'en_US.UTF-8', 'XDG_DATA_DIRS': '/usr/share', 'VENDOR': 'suse', 'PATH': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin', 'PROFILEREAD': 'true', 'MAIL': '/var/mail/abuild', 'HOSTTYPE': 'x86_64', 'RPM_BUILD_NCPUS': '12', 'RPM_PACKAGE_NAME': 'python-pylint', 'LESSKEY': '/usr/etc/lesskey.bin', 'RPM_BUILD_ROOT': '/home/abuild/rpmbuild/BUILDROOT/python-pylint-2.15.0-0.x86_64', 'OLDPWD': '/home/abuild/rpmbuild/BUILD', '_': '/usr/bin/pytest-3.8', 'tmp_path_env': '/tmp/pytest-of-abuild/pytest-356/test_can_read_toml_env_variabl0/pyproject.toml', 'PYTEST_CURRENT_TEST': 'tests/testutils/test_testutils_utils.py::test__test_environ_pythonpath_no_arg (call)'})> = environ({'PYTHONDONTWRITEBYTECODE': '1', 'SHELL': '/bin/bash', 'RPM_SOURCE_DIR': '/home/abuild/rpmbuild/SOURCES', 'XDG_CONFIG_DIRS': '/etc/xdg:/usr/etc/xdg', 'LESS': '-M -I -R', 'MACHTYPE': 'x86_64-suse-linux', 'PKG_CONFIG_PATH': ':/usr/lib64/pkgconfig:/usr/share/pkgconfig', 'HISTSIZE': '1000', 'HOSTNAME': 'skylab', 'MINICOM': '-c on', 'PYTHONHASHSEED': '0', 'CPU': 'x86_64', 'XDG_CONFIG_HOME': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/xdgflavorconfig', 'GPG_TTY': 'not a tty', 'PWD': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0', 'SOURCE_DATE_EPOCH': '1661558400', 'LOGNAME': 'abuild', 'SUSE_ZNOW': '1', 'RPM_ARCH': 'x86_64', 'XKEYSYMDB': '/usr/X11R6/lib/X11/XKeysymDB', 'XNLSPATH': '/usr/X11R6/lib/X11/nls', 'HOME': '/home/abuild', 'LANG': 'C', 'OSTYPE': 'linux', 'LESS_ADVANCED_PREPROCESSOR': 'no', 'RPM_PACKAGE_RELEASE': '0', 'PERL_HASH_SEED': '42', 'RPM_OS': 'linux', 'SUSE_IGNORED_RPATHS': '/etc/suse-ignored-rpaths.conf', 'MALLOC_PERTURB_': '69', 'LESSCLOSE': 'lessclose.sh %s %s', 'TERM': 'xterm-256color', 'HOST': 'skylab', 'LESSOPEN': 'lessopen.sh %s', 'USER': 'abuild', 'SUSE_ASNEEDED': '1', 'MORE': '-sl', 'CSHEDIT': 'emacs', 'SHLVL': '1', 'RPM_BUILD_DIR': '/home/abuild/rpmbuild/BUILD', 'WINDOWMANAGER': 'xterm', 'PAGER': 'less', 'MALLOC_CHECK_': '3', 'FORCE_SOURCE_DATE': '1', 'RPM_OPT_FLAGS': '-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g', 'RPM_DOC_DIR': '/usr/share/doc/packages', 'QT_HASH_SEED': '0', 'RPM_PACKAGE_VERSION': '2.15.0', 'LC_ALL': 'en_US.UTF-8', 'XDG_DATA_DIRS': '/usr/share', 'VENDOR': 'suse', 'PATH': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin', 'PROFILEREAD': 'true', 'MAIL': '/var/mail/abuild', 'HOSTTYPE': 'x86_64', 'RPM_BUILD_NCPUS': '12', 'RPM_PACKAGE_NAME': 'python-pylint', 'LESSKEY': '/usr/etc/lesskey.bin', 'RPM_BUILD_ROOT': '/home/abuild/rpmbuild/BUILDROOT/python-pylint-2.15.0-0.x86_64', 'OLDPWD': '/home/abuild/rpmbuild/BUILD', '_': '/usr/bin/pytest-3.8', 'tmp_path_env': '/tmp/pytest-of-abuild/pytest-356/test_can_read_toml_env_variabl0/pyproject.toml', 'PYTEST_CURRENT_TEST': 'tests/testutils/test_testutils_utils.py::test__test_environ_pythonpath_no_arg (call)'}).get
[  111s] E            +      where environ({'PYTHONDONTWRITEBYTECODE': '1', 'SHELL': '/bin/bash', 'RPM_SOURCE_DIR': '/home/abuild/rpmbuild/SOURCES', 'XDG_CONFIG_DIRS': '/etc/xdg:/usr/etc/xdg', 'LESS': '-M -I -R', 'MACHTYPE': 'x86_64-suse-linux', 'PKG_CONFIG_PATH': ':/usr/lib64/pkgconfig:/usr/share/pkgconfig', 'HISTSIZE': '1000', 'HOSTNAME': 'skylab', 'MINICOM': '-c on', 'PYTHONHASHSEED': '0', 'CPU': 'x86_64', 'XDG_CONFIG_HOME': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/xdgflavorconfig', 'GPG_TTY': 'not a tty', 'PWD': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0', 'SOURCE_DATE_EPOCH': '1661558400', 'LOGNAME': 'abuild', 'SUSE_ZNOW': '1', 'RPM_ARCH': 'x86_64', 'XKEYSYMDB': '/usr/X11R6/lib/X11/XKeysymDB', 'XNLSPATH': '/usr/X11R6/lib/X11/nls', 'HOME': '/home/abuild', 'LANG': 'C', 'OSTYPE': 'linux', 'LESS_ADVANCED_PREPROCESSOR': 'no', 'RPM_PACKAGE_RELEASE': '0', 'PERL_HASH_SEED': '42', 'RPM_OS': 'linux', 'SUSE_IGNORED_RPATHS': '/etc/suse-ignored-rpaths.conf', 'MALLOC_PERTURB_': '69', 'LESSCLOSE': 'lessclose.sh %s %s', 'TERM': 'xterm-256color', 'HOST': 'skylab', 'LESSOPEN': 'lessopen.sh %s', 'USER': 'abuild', 'SUSE_ASNEEDED': '1', 'MORE': '-sl', 'CSHEDIT': 'emacs', 'SHLVL': '1', 'RPM_BUILD_DIR': '/home/abuild/rpmbuild/BUILD', 'WINDOWMANAGER': 'xterm', 'PAGER': 'less', 'MALLOC_CHECK_': '3', 'FORCE_SOURCE_DATE': '1', 'RPM_OPT_FLAGS': '-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g', 'RPM_DOC_DIR': '/usr/share/doc/packages', 'QT_HASH_SEED': '0', 'RPM_PACKAGE_VERSION': '2.15.0', 'LC_ALL': 'en_US.UTF-8', 'XDG_DATA_DIRS': '/usr/share', 'VENDOR': 'suse', 'PATH': '/home/abuild/rpmbuild/BUILD/pylint-2.15.0/build/flavorbin:/usr/local/bin:/usr/bin:/bin', 'PROFILEREAD': 'true', 'MAIL': '/var/mail/abuild', 'HOSTTYPE': 'x86_64', 'RPM_BUILD_NCPUS': '12', 'RPM_PACKAGE_NAME': 'python-pylint', 'LESSKEY': '/usr/etc/lesskey.bin', 'RPM_BUILD_ROOT': '/home/abuild/rpmbuild/BUILDROOT/python-pylint-2.15.0-0.x86_64', 'OLDPWD': '/home/abuild/rpmbuild/BUILD', '_': '/usr/bin/pytest-3.8', 'tmp_path_env': '/tmp/pytest-of-abuild/pytest-356/test_can_read_toml_env_variabl0/pyproject.toml', 'PYTEST_CURRENT_TEST': 'tests/testutils/test_testutils_utils.py::test__test_environ_pythonpath_no_arg (call)'}) = os.environ
[  111s] 
[  111s] tests/testutils/test_testutils_utils.py:56: AssertionError
[  111s] =========================== short test summary info ============================
bnavigator added a commit to bnavigator/pylint that referenced this issue Aug 27, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Maintenance Discussion or action around maintaining pylint or the dev workflow label Aug 27, 2022
bnavigator added a commit to bnavigator/pylint that referenced this issue Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants