diff --git a/pyproject.toml b/pyproject.toml index 6929457f..48fbb11e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,9 +140,13 @@ package-data = { "ultralytics" = ["**/*.yaml"], "ultralytics.assets" = ["*.jpg"] [tool.setuptools.dynamic] version = { attr = "ultralytics.__version__" } -[tool.pytest] -norecursedirs = [".git", "dist", "build"] +[tool.pytest.ini_options] addopts = "--doctest-modules --durations=30 --color=yes" +markers = [ + "slow: skip slow tests unless --slow is set", +] +norecursedirs = [".git", "dist", "build"] + [tool.coverage.run] source = ["ultralytics/"] diff --git a/tests/conftest.py b/tests/conftest.py index 06c0d140..58c07b79 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,8 +3,6 @@ import shutil from pathlib import Path -import pytest - TMP = Path(__file__).resolve().parent / "tmp" # temp directory for test files @@ -18,27 +16,6 @@ def pytest_addoption(parser): parser.addoption("--slow", action="store_true", default=False, help="Run slow tests") -def pytest_configure(config): - """ - Register custom markers to avoid pytest warnings. - - Args: - config (pytest.config.Config): The pytest config object. - """ - config.addinivalue_line("markers", "slow: mark test as slow to run") - - -def pytest_runtest_setup(item): - """ - Setup hook to skip tests marked as slow if the --slow option is not provided. - - Args: - item (pytest.Item): The test item object. - """ - if "slow" in item.keywords and not item.config.getoption("--slow"): - pytest.skip("skip slow tests unless --slow is set") - - def pytest_collection_modifyitems(config, items): """ Modify the list of test items to remove tests marked as slow if the --slow option is not provided.