Skip to content

Commit

Permalink
fix: reuseable code moved to common block
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairshakoorarbisoft committed Dec 8, 2023
1 parent 18ef686 commit d1a1bc2
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pytest_repo_health/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ def pytest_configure(config):
pytest hook used to add plugin install dir as place for pytest to find tests
"""

# in case repo_health checks are in separate repo
repo_health_path = config.getoption("repo_health_path")
if any([config.getoption("repo_health"), config.getoption("dependencies_health")]):
# Change test prefix to check only if it ran for
# repo_health or dependencies_health
config._inicache['python_files'] = ['check_*.py'] # pylint: disable=protected-access
config._inicache['python_functions'] = ['check_*'] # pylint: disable=protected-access
# in case repo_health checks are in separate repo
repo_health_path = config.getoption("repo_health_path")
if repo_health_path is not None:
config.args.append(os.path.abspath(repo_health_path))

if config.getoption("repo_health"):

# Add path to pytest-repo-health dir so pytest knows where to look for checks
file_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
config.args.append(file_dir)
Expand All @@ -60,12 +61,6 @@ def pytest_configure(config):
if get_repo_remote_name(repo_path) != get_repo_remote_name(repo_health_path):
config.args.append(os.path.abspath(repo_path))

if repo_health_path is not None:
config.args.append(os.path.abspath(repo_health_path))
elif config.getoption("dependencies_health"):
if repo_health_path is not None:
config.args.append(os.path.abspath(repo_health_path))

return config


Expand Down

0 comments on commit d1a1bc2

Please sign in to comment.