Update pytest discovery rules

This commit is contained in:
Michael Mintz 2019-11-05 01:54:02 -05:00
parent ad31f3915e
commit dae07aaa91
2 changed files with 17 additions and 0 deletions

View File

@ -6,6 +6,13 @@ addopts = --capture=no --ignore conftest.py -p no:cacheprovider
# Ignore warnings such as DeprecationWarning and pytest.PytestUnknownMarkWarning
filterwarnings = ignore::pytest.PytestWarning
# Set pytest discovery rules:
# (Most of the rules here are similar to the default rules.)
# (unittest.TestCase rules override the rules here for classes and functions.)
python_files = test_*.py *_test.py *_tests.py *_suite.py
python_classes = Test* *Test* *Test *Tests *Suite
python_functions = test_*
# Here are the pytest markers used in the example tests:
# (pytest v4.5.0 and newer requires marker registration to prevent warnings.)
# (Future versions of pytest may turn those marker warnings into errors.)

View File

@ -55,6 +55,16 @@ def main():
data.append("addopts = --capture=no --ignore conftest.py "
"-p no:cacheprovider")
data.append("filterwarnings = ignore::pytest.PytestWarning")
data.append("python_files = test_*.py *_test.py *_tests.py *_suite.py")
data.append("python_classes = Test* *Test* *Test *Tests *Suite")
data.append("python_functions = test_*")
data.append("markers =")
data.append(" marker1: custom marker")
data.append(" marker2: custom marker")
data.append(" marker3: custom marker")
data.append(" marker_test_suite: custom marker")
data.append(" expected_failure: custom marker")
data.append("")
file_path = "%s/%s" % (dir_name, "pytest.ini")
file = codecs.open(file_path, "w+", "utf-8")
file.writelines("\r\n".join(data))