From c37ae1e0eaa5ab3850020f109e6bb7fb9e8f3ed3 Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 19 Apr 2021 17:31:01 +0530 Subject: [PATCH] Modify pytest configuration Shift it from monkey/pytest.ini to pyproject.toml. Add conftest.py in tests/ to add monkey directory to sys.path so test files recognize paths. --- monkey/pytest.ini | 7 ------- monkey/tests/conftest.py | 5 +++++ pyproject.toml | 10 ++++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 monkey/pytest.ini create mode 100644 monkey/tests/conftest.py diff --git a/monkey/pytest.ini b/monkey/pytest.ini deleted file mode 100644 index 9b1766fc2..000000000 --- a/monkey/pytest.ini +++ /dev/null @@ -1,7 +0,0 @@ -[pytest] -log_cli = 1 -log_cli_level = DEBUG -log_cli_format = %(asctime)s [%(levelname)s] %(module)s.%(funcName)s.%(lineno)d: %(message)s -log_cli_date_format=%H:%M:%S -addopts = -v --capture=sys --ignore=common/cloud/scoutsuite -norecursedirs = node_modules dist diff --git a/monkey/tests/conftest.py b/monkey/tests/conftest.py new file mode 100644 index 000000000..12602eae4 --- /dev/null +++ b/monkey/tests/conftest.py @@ -0,0 +1,5 @@ +import sys +from pathlib import Path + +MONKEY_BASE_PATH = str(Path(__file__).parent.parent) +sys.path.insert(0, MONKEY_BASE_PATH) diff --git a/pyproject.toml b/pyproject.toml index 077d3aeb8..bbf778536 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,13 @@ include_trailing_comma = true force_grid_wrap = 0 use_parentheses = true ensure_newline_before_comments = true + +[tool.pytest.ini_options] +minversion = "6.0" +log_cli = 1 +log_cli_level = "DEBUG" +log_cli_format = "%(asctime)s [%(levelname)s] %(module)s.%(funcName)s.%(lineno)d: %(message)s" +log_cli_date_format = "%H:%M:%S" +addopts = "-v --capture=sys" +norecursedirs = "node_modules dist" +testpaths = "monkey/tests"