From the course: Managing Python Projects

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Skipping and marks

Skipping and marks - Python Tutorial

From the course: Managing Python Projects

Start my 1-month free trial

Skipping and marks

- [Instructor] Developers are impatient, which according to Larry Wall, the creator of the Perl programming language, is a good thing. Developers won't run the tests as often if they think they are taking too much time. Also, in some cases, tests will require a complicated environment that is not available on a developer machine. Say a big database, special hardware, et cetera. To solve this problem, we have two ways to skip tests in pytest, skip and marks. Here's an example of how to skip test. I'm going to check if CI is found in the environment. This is a common environment variable that a lot of CI, continuous integration systems, are setting prior to running the tests. And now, I can run python -m pytest -v test_skip. And this test is going to get skipped, because CI is not set in the environment. If I'm going to set the CI environment variable, CI=, let's say circle CI and now, the test is going to run. The other…

Contents