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

CLI test broken #3234

Closed
jopemachine opened this issue Dec 10, 2024 · 0 comments · Fixed by #3235
Closed

CLI test broken #3234

jopemachine opened this issue Dec 10, 2024 · 0 comments · Fixed by #3235
Assignees
Milestone

Comments

@jopemachine
Copy link
Member

jopemachine commented Dec 10, 2024

What Operating System(s) are you seeing this problem on?

Linux (x86-64)

Backend.AI version

main

Describe the bug

The test_cli_commands.py test is failing as follows.

> pants test tests/client/cli/test_cli_commands.py
11:32:03.18 [ERROR] Completed: Run Pytest - tests/client/cli/test_cli_commands.py:tests - failed (exit code 1).
============================= test session starts ==============================
platform darwin -- Python 3.12.6, pytest-8.3.4, pluggy-1.5.0 -- /Users/jopemachine/.cache/pants/named_caches/pex_root/venvs/s/77f7b40c/venv/bin/python3.12
cachedir: .pytest_cache
rootdir: /private/tmp/backend.ai-LChTfmpxfEcYb7so-pants/pants-sandbox-rLE8Ui
configfile: pyproject.toml
plugins: asyncio-0.24.0, cov-6.0.0, typeguard-4.4.1, Faker-24.7.1, custom-exit-code-0.3.0, dependency-0.6.0, aiohttp-1.0.5, timeout-2.3.1, mock-3.14.0
asyncio: mode=Mode.AUTO, default_loop_scope=None
collecting ... collected 6 items

tests/client/cli/test_cli_commands.py::test_print_help[-h] PASSED        [ 16%]
tests/client/cli/test_cli_commands.py::test_print_help[--help] PASSED    [ 33%]
tests/client/cli/test_cli_commands.py::test_print_help_for_unknown_command PASSED [ 50%]
tests/client/cli/test_cli_commands.py::test_config FAILED                [ 66%]
tests/client/cli/test_cli_commands.py::test_config_unset FAILED          [ 83%]
tests/client/cli/test_cli_commands.py::test_run_file_or_code_required PASSED [100%]

=================================== FAILURES ===================================
_________________________________ test_config __________________________________

runner = <click.testing.CliRunner object at 0x1048f3e30>
cli_entrypoint = <ExtendedCommandGroup main>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x107d95a00>
example_keypair = ('AKIAIOSFODNN7EXAMPLE', 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY')
unused_tcp_port_factory = <function unused_tcp_port_factory.<locals>.factory at 0x107e005e0>

    def test_config(runner, cli_entrypoint, monkeypatch, example_keypair, unused_tcp_port_factory):
        api_port = unused_tcp_port_factory()
        api_url = "http://127.0.0.1:{}".format(api_port)
        set_config(None)
        monkeypatch.setenv("BACKEND_ACCESS_KEY", example_keypair[0])
        monkeypatch.setenv("BACKEND_SECRET_KEY", example_keypair[1])
        monkeypatch.setenv("BACKEND_ENDPOINT", api_url)
        config = get_config()
        result = runner.invoke(cli_entrypoint, ["config"])
>       assert result.exit_code == ExitCode.OK
E       assert 1 == <ExitCode.OK: 0>
E        +  where 1 = <Result AttributeError("'tuple' object has no attribute 'netloc'")>.exit_code
E        +  and   <ExitCode.OK: 0> = ExitCode.OK

tests/client/cli/test_cli_commands.py:43: AssertionError
______________________________ test_config_unset _______________________________

runner = <click.testing.CliRunner object at 0x1048f3e30>
cli_entrypoint = <ExtendedCommandGroup main>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x107d9a210>

    def test_config_unset(runner, cli_entrypoint, monkeypatch):
        monkeypatch.delenv("BACKEND_ACCESS_KEY", raising=False)
        monkeypatch.delenv("BACKEND_SECRET_KEY", raising=False)
        monkeypatch.delenv("BACKEND_ENDPOINT", raising=False)
        # now this works as "anonymous" session config.
        result = runner.invoke(cli_entrypoint, ["config"])
>       assert result.exit_code == ExitCode.OK
E       assert 1 == <ExitCode.OK: 0>
E        +  where 1 = <Result AttributeError("'tuple' object has no attribute 'netloc'")>.exit_code
E        +  and   <ExitCode.OK: 0> = ExitCode.OK

tests/client/cli/test_cli_commands.py:57: AssertionError
- generated xml file: tests.client.cli.test_cli_commands.py.tests.xml -
=========================== short test summary info ============================
FAILED tests/client/cli/test_cli_commands.py::test_config - assert 1 == <ExitCode.OK: 0>
FAILED tests/client/cli/test_cli_commands.py::test_config_unset - assert 1 == <ExitCode.OK: 0>
========================= 2 failed, 4 passed in 0.36s ==========================

/Users/jopemachine/.cache/pants/named_caches/pex_root/venvs/s/77f7b40c/venv/lib/python3.12/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))



✕ tests/client/cli/test_cli_commands.py:tests failed after 3 attempts in 0.90s.

To Reproduce

Run the test as follows.

Expected Behavior

The test should pass.

Anything else?

None

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

Successfully merging a pull request may close this issue.

1 participant