Skip to content
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

test_console_script_module_wheel and test_console_script_package_wheel fail on Python 3.7 with importlib_metadata >= 5 #420

Closed
kislyuk opened this issue Mar 26, 2023 · 8 comments

Comments

@kislyuk
Copy link
Owner

kislyuk commented Mar 26, 2023

Unclear if this is an actual issue or a test case artifact.

======================================================================
FAIL: test_console_script_module_wheel (__main__.TestBashGlobal)
Test completing a console_script for a module from a wheel.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test.py", line 1326, in test_console_script_module_wheel
    self._test_console_script(wheel=True)
  File "./test/test.py", line 1311, in _test_console_script
    self.assertEqual(self.sh.run_command(command), "arg\r\n")
AssertionError: "usage: test-module [-h] {arg}\r\ntest-mo[66 chars]\r\n" != 'arg\r\n'
+ arg
- usage: test-module [-h] {arg}
- test-module: error: argument arg: invalid choice: 'a' (choose from 'arg')
======================================================================
FAIL: test_console_script_package_wheel (__main__.TestBashGlobal)
Test completing a console_script for a package from a wheel.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test/test.py", line 1331, in test_console_script_package_wheel
    self._test_console_script(package=True, wheel=True)
  File "./test/test.py", line 1311, in _test_console_script
    self.assertEqual(self.sh.run_command(command), "arg\r\n")
AssertionError: "usage: test-package [-h] {arg}\r\ntest-p[68 chars]\r\n" != 'arg\r\n'
+ arg
- usage: test-package [-h] {arg}
- test-package: error: argument arg: invalid choice: 'a' (choose from 'arg')


----------------------------------------------------------------------
@flu0r1ne
Copy link
Contributor

I've recently noticed an issue and it's highly likely that it's related to #436.

@hroncok
Copy link
Contributor

hroncok commented Jun 14, 2023

I get the same failures in Fedora with Python 3.12.0b2 even with(out) #436:

=================================== FAILURES ===================================
__________________ TestBashGlobal.test_console_script_module ___________________

self = <test.test.TestBashGlobal testMethod=test_console_script_module>

    @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS")
    def test_console_script_module(self):
        """Test completing a console_script for a module."""
>       self._test_console_script()

test/test.py:1293: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test.py:1288: in _test_console_script
    self.assertEqual(self.sh.run_command(command), 'arg\r\n')
E   AssertionError: "usage: test-module [-h] {arg}\r\ntest-mo[66 chars]\r\n" != 'arg\r\n'
E   + arg
E   - usage: test-module [-h] {arg}
E   - test-module: error: argument arg: invalid choice: 'a' (choose from 'arg')
_______________ TestBashGlobal.test_console_script_module_wheel ________________

self = <test.test.TestBashGlobal testMethod=test_console_script_module_wheel>

    @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS")
    def test_console_script_module_wheel(self):
        """Test completing a console_script for a module from a wheel."""
>       self._test_console_script(wheel=True)

test/test.py:1303: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test.py:1288: in _test_console_script
    self.assertEqual(self.sh.run_command(command), 'arg\r\n')
E   AssertionError: "usage: test-module [-h] {arg}\r\ntest-mo[66 chars]\r\n" != 'arg\r\n'
E   + arg
E   - usage: test-module [-h] {arg}
E   - test-module: error: argument arg: invalid choice: 'a' (choose from 'arg')
__________________ TestBashGlobal.test_console_script_package __________________

self = <test.test.TestBashGlobal testMethod=test_console_script_package>

    @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS")
    def test_console_script_package(self):
        """Test completing a console_script for a package."""
>       self._test_console_script(package=True)

test/test.py:1298: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test.py:1288: in _test_console_script
    self.assertEqual(self.sh.run_command(command), 'arg\r\n')
E   AssertionError: "usage: test-package [-h] {arg}\r\ntest-p[68 chars]\r\n" != 'arg\r\n'
E   + arg
E   - usage: test-package [-h] {arg}
E   - test-package: error: argument arg: invalid choice: 'a' (choose from 'arg')
_______________ TestBashGlobal.test_console_script_package_wheel _______________

self = <test.test.TestBashGlobal testMethod=test_console_script_package_wheel>

    @unittest.skipIf(os.uname()[0] == "Darwin", "Skip test that fails on MacOS")
    def test_console_script_package_wheel(self):
        """Test completing a console_script for a package from a wheel."""
>       self._test_console_script(package=True, wheel=True)

test/test.py:1308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test.py:1288: in _test_console_script
    self.assertEqual(self.sh.run_command(command), 'arg\r\n')
E   AssertionError: "usage: test-package [-h] {arg}\r\ntest-p[68 chars]\r\n" != 'arg\r\n'
E   + arg
E   - usage: test-package [-h] {arg}
E   - test-package: error: argument arg: invalid choice: 'a' (choose from 'arg')

@kislyuk
Copy link
Owner Author

kislyuk commented Jun 14, 2023

@hroncok that looks like pytest output. Is that right?

@kislyuk
Copy link
Owner Author

kislyuk commented Jun 14, 2023

OK, I'm fairly certain the output you pasted above is from Pytest @hroncok .

Please respect the maintainers' time and refrain from posting bug reports in this project based on test failures in pytest. This package's default configuration provides for running tests using unittest, and only test failures in unittest should be considered. While pytest's unittest emulation is pretty good, it's not perfect and it's not good enough for running tests in this package.

I'm going to close this issue now since the tests in question pass on Python 3.7 after @flu0r1ne's fix (thanks!)

@kislyuk kislyuk closed this as completed Jun 14, 2023
@hroncok
Copy link
Contributor

hroncok commented Jun 14, 2023

Yes it is pytest, but no, it's not happening just with pytest. I merely used pytest to have a nicer control of running only the tests I wanted to show. Same failures happen without pytest.

@kislyuk
Copy link
Owner Author

kislyuk commented Jun 14, 2023

OK, sounds like this might be a Python 3.12 issue. It's probably not related to the issue with the backport that we fixed. Please open a separate issue.

@hroncok
Copy link
Contributor

hroncok commented Jun 14, 2023

Please open a separate issue.

Will do.

@hroncok
Copy link
Contributor

hroncok commented Jun 14, 2023

#440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants