pawamoy / pawamoy.github.io

http://pawamoy.github.io/
2 stars 0 forks source link

posts/save-pytest-logs-as-artifact-gitlab-ci/ #18

Closed utterances-bot closed 2 years ago

utterances-bot commented 4 years ago

Save the logs generated during a pytest run as a job artifact on GitLab CI - pawamoy's website

Findings, thoughts, tutorials, work. Pieces of my mind!

https://pawamoy.github.io/posts/save-pytest-logs-as-artifact-gitlab-ci/

pawamoy commented 4 years ago

Original author: hero1900 @hero1900
Original date: 2020-02-24T11:54:59Z

thank you so much for sharing. i have question. do you know how i can seperate the logs for each test. i have multiple tests and i need to have 3 logs for each test.

1- log for the setup (fixture in test conftest)
2- log for the test itself
3- log for teardown (fixture in test conftest)

pawamoy commented 4 years ago

Original date: 2020-03-05T18:21:45Z

Hi, glad you liked the post, and sorry for the late answer :)

I think you should look into that section of the docs: https://docs.pytest.org/en/..., particularly this section: https://docs.pytest.org/en/..., which shows how you can declare *one* fixture that will run code in setup, the test, then teardown, using a yield statement.

I hope this helps!