In this lesson, you will learn:
- The basics of building a Pytest test.
- About Python Assert.
- How to build a basic test in Pytest.
- How to run a test in Pytest.
- About Pytests test discovery.
Creating Your First Test
Tests within Pytest are based upon using the
assert is a built-in keyword within Python that allows us to:
test if a condition in our code returns
If the condition after the
assert does not return
True, then an
AssertionError exception will be raised (example shown below):
>>> assert 1 == 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError >>> assert 1 == 1 >>>