Wilson194 / Labelord

A simple server-based application that synchronizes labels through github repositories.
GNU General Public License v3.0
0 stars 0 forks source link

Wrong exit codes when there is no config.cfg #1

Closed hroncok closed 6 years ago

hroncok commented 7 years ago

See https://github.com/MarekSuchanek/labelord_tests/issues/6

Running tests from MarekSuchanek/labelord_tests@c99594275de8f3cc08da743876c1e773a0f3274c

$ LABELORD_SESSION_SPY=off python -m pytest -v tests/
============================================== test session starts ==============================================
platform linux -- Python 3.6.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- /home/churchyard/ownCloud/Škola/171/students/__labelord_venv__/bin/python
cachedir: .cache
rootdir: /home/churchyard/ownCloud/Škola/171/students/horacj10__Wilson194/MI-PYT-DU1, inifile:
plugins: betamax-0.8.0
collected 81 items                                                                                               

...
tests/test_run_tricky.py::test_help_list_labels[True] FAILED
tests/test_run_tricky.py::test_help_list_labels[False] FAILED
tests/test_run_tricky.py::test_help_list_repos[True] FAILED
tests/test_run_tricky.py::test_help_list_repos[False] FAILED
tests/test_run_tricky.py::test_help_list_run[True] FAILED
tests/test_run_tricky.py::test_help_list_run[False] FAILED
...
tests/test_run_tricky.py::test_precedence_template_repo FAILED
...

=================================================== FAILURES ====================================================
__________________________________________ test_help_list_labels[True] __________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f9686736d08>, isolated = True

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_labels(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (help text may differ):
        # Usage: labelord.py list_labels [OPTIONS] REPOSITORY
        #
        # Listing labels of desired repository.
        #
        # Options:
        #   --help  Show this message and exit.
        invocation = invoker_norec('list_labels', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f96867007f0>.result

tests/test_run_tricky.py:117: AssertionError
_________________________________________ test_help_list_labels[False] __________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f9686736bf8>, isolated = False

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_labels(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (help text may differ):
        # Usage: labelord.py list_labels [OPTIONS] REPOSITORY
        #
        # Listing labels of desired repository.
        #
        # Options:
        #   --help  Show this message and exit.
        invocation = invoker_norec('list_labels', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f9686761cf8>.result

tests/test_run_tricky.py:117: AssertionError
__________________________________________ test_help_list_repos[True] ___________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f96867097b8>, isolated = True

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_repos(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (help text may differ):
        # Usage: labelord.py list_repos [OPTIONS]
        #
        # Listing accessible repositories.
        #
        # Options:
        #   --help Show this message and exit.
        invocation = invoker_norec('list_repos', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f968688e1d0>.result

tests/test_run_tricky.py:137: AssertionError
__________________________________________ test_help_list_repos[False] __________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f9686771488>, isolated = False

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_repos(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (help text may differ):
        # Usage: labelord.py list_repos [OPTIONS]
        #
        # Listing accessible repositories.
        #
        # Options:
        #   --help Show this message and exit.
        invocation = invoker_norec('list_repos', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f96867158d0>.result

tests/test_run_tricky.py:137: AssertionError
___________________________________________ test_help_list_run[True] ____________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f9686794a60>, isolated = True

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_run(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (types and help texts may differ):
        # Usage: labelord.py run [OPTIONS] <update|replace>
        #
        # Run labels processing.
        #
        # Options:
        #   -r, --template-repo TEXT  Repository which serves as labels template.
        #   -d, --dry-run             Proceed with just dry run.
        #   -v, --verbose             Really exhaustive output.
        #   -q, --quiet               No output at all.
        #   -a, --all-repos           Run for all repositories available.
        #   --help                    Show this message and exit.
        invocation = invoker_norec('run', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f9686758048>.result

tests/test_run_tricky.py:162: AssertionError
___________________________________________ test_help_list_run[False] ___________________________________________

invoker_norec = <function invoker.<locals>.invoker_inner at 0x7f96867369d8>, isolated = False

    @pytest.mark.parametrize('isolated', [True, False])
    def test_help_list_run(invoker_norec, isolated):
        # There must be standard click help describing options
        # and commands (you should write description for each)
        #
        # Local default config is not required (no token for help is OK)!
        #
        # It could look like this (types and help texts may differ):
        # Usage: labelord.py run [OPTIONS] <update|replace>
        #
        # Run labels processing.
        #
        # Options:
        #   -r, --template-repo TEXT  Repository which serves as labels template.
        #   -d, --dry-run             Proceed with just dry run.
        #   -v, --verbose             Really exhaustive output.
        #   -q, --quiet               No output at all.
        #   -a, --all-repos           Run for all repositories available.
        #   --help                    Show this message and exit.
        invocation = invoker_norec('run', '--help', isolated=isolated)

>       assert invocation.result.exit_code == 0
E       assert 3 == 0
E        +  where 3 = <Result SystemExit(3,)>.exit_code
E        +    where <Result SystemExit(3,)> = <conftest.LabelordInvocation object at 0x7f96868787b8>.result

tests/test_run_tricky.py:162: AssertionError
_________________________________________ test_precedence_template_repo _________________________________________

invoker = <function invoker.<locals>.invoker_inner at 0x7f9686709a60>
utils = <conftest.Utils object at 0x7f968672f278>

    def test_precedence_template_repo(invoker, utils):
        # repo4 is empty and has higher precedence than repo3
        # in the config
        invocation = invoker('-c', utils.config('config_templaterepo'),
                             'run', 'update', '-r', 'MarekSuchanek/repo4',
                             session_expectations={
                                 'get': 3,
                                 'post': 0,
                                 'patch': 0,
                                 'delete': 0
                             })
        lines = invocation.result.output.split('\n')

>       assert invocation.result.exit_code == 0
E       assert 2 == 0
E        +  where 2 = <Result SystemExit(2,)>.exit_code
E        +    where <Result SystemExit(2,)> = <conftest.LabelordInvocation object at 0x7f968672fbe0>.result

tests/test_run_tricky.py:198: AssertionError
====================================== 7 failed, 74 passed in 0.76 seconds ======================================

Use v0.1.1 etc. tags if you will provide next iteration.

Wilson194 commented 6 years ago

Fixed, new version at tag v0.1.1 @hroncok @MarekSuchanek

MarekSuchanek commented 6 years ago

OK, works... giving 5 points.

(Code style is mentioned already in #2)