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

Ignore --clean-alluredir when using --collectonly #753

Merged
merged 4 commits into from Dec 7, 2023

Conversation

ShurikMen
Copy link
Contributor

@ShurikMen ShurikMen commented Jul 25, 2023

Context

When displaying a list of tests with the --collectonly key, the last test execution result is cleared.
To prevent the result from being lost, added ignoring cleaning (--clean-alluredir) if there is a key to only output the list of tests ( --collectonly).

Checklist

@skhomuti
Copy link
Collaborator

Good idea! Also, it makes sense for all args that don't cause test running. --setup-plan for example. Need to find a way to check it properly. Maybe pytest give it somewhere in params or args

@ShurikMen
Copy link
Contributor Author

Good idea! Also, it makes sense for all args that don't cause test running. --setup-plan for example. Need to find a way to check it properly. Maybe pytest give it somewhere in params or args

For --setup-plan, the situation is a little different, because if with --coollect-only tests are not run at all (immediately exiting pytest_runtestloop without starting pytest_runtest_protocol), then with --setup-plan tests are run in --setup-only mode. All tests are "executed" without full execution. Allure makes a full report on this execution.
Well, --setup-plan remains useful when you need to see how the report will look like without running tests.

@alexterent
Copy link

And what about --co ? Will it work?

@skhomuti
Copy link
Collaborator

skhomuti commented Dec 6, 2023

@delatrie could you look at this PR pls?

Copy link
Contributor

@delatrie delatrie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! And sorry, it took me so long.

I like this feature!
It would be nice to have tests though. Could you, please, add an acceptance test for each package involved? Something like this should work:

def test_no_clean_if_collectonly(allure_pytest_runner: AllurePytestRunner):
    alluredir = allure_pytest_runner.pytester.path
    allure_pytest_runner.in_memory = False

    allure_pytest_runner.run_pytest(
        "def test_fn(): pass",
        cli_args=["--collectonly", "--clean-alluredir"]
    )

    assert alluredir.joinpath("test_collectonly.py").exists()

And the same goes for allure-pytest-bdd, but the fixture would be allure_pytest_bdd_runner: AllurePytestRunner.
If you have any struggles, feel free to ping me here.

@ShurikMen
Copy link
Contributor Author

It would be nice to have tests though.

@delatrie done

@delatrie
Copy link
Contributor

delatrie commented Dec 7, 2023

Great, thanks!
Extra kudos for increasing test coverage!

@delatrie delatrie merged commit 5b9d37c into allure-framework:master Dec 7, 2023
14 checks passed
IvanBuruyane pushed a commit to IvanBuruyane/allure-python that referenced this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants