-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathtest_methods.py
More file actions
32 lines (25 loc) · 1.21 KB
/
Copy pathtest_methods.py
File metadata and controls
32 lines (25 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ---------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in project root for information.
# ---------------------------------------------------------------------------------
"""This is a sample python file for testing functions from the source code."""
from __future__ import annotations
from python_package.hello_world import hello_world
def hello_test():
"""
This defines the expected usage, which can then be used in various test cases.
Pytest will not execute this code directly, since the function does not contain the prefix "test"
"""
assert hello_world() == "string-0"
def test_hello(unit_test_mocks: None):
"""
This is a simple test, which can use a mock to override online functionality.
unit_test_mocks: Fixture located in conftest.py, implictly imported via pytest.
"""
hello_test()
def test_int_hello():
"""
This test is marked implicitly as an integration test because the name contains "_int_"
https://docs.pytest.org/en/6.2.x/example/markers.html#automatically-adding-markers-based-on-test-names
"""
hello_test()