Skip to content

Commit

Permalink
Move flags from tests to config (iterative#4943)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Nov 23, 2020
1 parent f1efc8f commit e332747
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
mkdir -p scripts/ci
echo "$GS_CREDS_JSON" > scripts/ci/gcp-creds.json
- name: run tests
run: python -m tests --all -ra --cov-report=xml --cov-report=term --tap-combined
run: python -m tests --all --cov-report=xml --cov-report=term --tap-combined
- name: upload coverage report
uses: codecov/[email protected]
with:
Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ count=true
profile=black
known_first_party=dvc,tests
line_length=79

[tool:pytest]
timeout = 600
timeout_method = thread
log_level = debug
addopts = -ra
5 changes: 1 addition & 4 deletions tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@

params = " ".join(sys.argv[1:])

cmd = (
"py.test -v -n=4 --timeout=600 --timeout_method=thread --log-level=debug"
" --cov=dvc {params} --durations=0".format(params=params)
)
cmd = "pytest -v -n=4 --cov=dvc --durations=0 {params}".format(params=params)
check_call(cmd, shell=True)
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from contextlib import suppress

import pytest

Expand Down Expand Up @@ -30,7 +31,11 @@ def reset_loglevel(request, caplog):
Use it to ensure log level at the start of each test
regardless of dvc.logger.setup(), Repo configs or whatever.
"""
level = request.config.getoption("--log-level")
ini_opt = None
with suppress(ValueError):
ini_opt = request.config.getini("log_level")

level = request.config.getoption("--log-level") or ini_opt
if level:
with caplog.at_level(level.upper(), logger="dvc"):
yield
Expand Down

0 comments on commit e332747

Please sign in to comment.