Steps to replicate the issue (include links if applicable):
- MacOS 12.6.1
- Python 3.9.13
- checkout pywikibot/core.git to 77482f4bab1822c7b604f7d1a4787ad2742ec991
- pytest tests/make_dist_tests.py
What happens?:
TestMakeDist.test_handle_args and TestMakeDist.test_handle_args_empty both fail with similar errors:
tests/make_dist_tests.py:26: in _test_argv self.assertEqual(__file__, sys.argv[0]) E AssertionError: '/Users/roy/dev/pywikibot/pywikibot-git/tests/make_dist_tests.py' != '/Users/roy/dev/pywikibot/venv/bin/pytest' E - /Users/roy/dev/pywikibot/pywikibot-git/tests/make_dist_tests.py E + /Users/roy/dev/pywikibot/venv/bin/pytest
The failure happens in _test_argv():
if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') != '1': self.assertEqual(__file__, sys.argv[0])
Note the exact value of sys.argv[0] varies depending on how I run the test. The above is when I run it from the command line. Inside vscode, I get:
/Users/roy/dev/pywikibot/venv/lib/python3.9/site-packages/pytest/__main__.py
and in vscode test debug mode, it's:
/Users/roy/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/testlauncher.py
This seems like a pointless test, as it's asserting a specific behavior for something which is environment dependent. I suggest deleting the argv[0] test completely.