What to tests in ci run vs pytest, and why

Question:

I have a python repo in github. If I understood it correctly there are mainly two ways in which tests can be automated:

  • using run in a ci.yml file
  • using test_... files under a folder called test (at root level) and then execute them in the ci pipeline by running pytest tests

What type of tests are more suitable for each of these options? And why?

Asked By: Mike B

||

Answers:

Nvm, I found this:

PyTest: pytest is well-suited for writing and executing unit tests, and it’s common to include unit tests written with pytest in the CI pipeline. Unit tests are focused on testing individual components or units of code in isolation. They help verify that each unit of code functions correctly and meets its expected behavior. These tests are typically faster to execute and provide immediate feedback on the correctness of individual units of code.

CI Tests: Integration tests are designed to test how different components of a system work together. They verify that the integration points and interactions between various units of code function correctly. Integration tests are valuable in catching issues that may arise due to interactions between different parts of the system.

Answered By: Mike B