Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion auto_dev/commands/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
is_flag=True,
default=False,
)
@click.option("-c", "--coverage-report/--no-coverage-report", help="Run the coverage report", is_flag=True, default=False)
@click.option(
"-c", "--coverage-report/--no-coverage-report", help="Run the coverage report", is_flag=True, default=False
)
@click.pass_context
def test(ctx, path, watch, coverage_report) -> None:
"""Run tests for packages.
Expand Down
12 changes: 8 additions & 4 deletions auto_dev/test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Module for testing the project."""

import os
from pathlib import Path
from multiprocessing import cpu_count

import pytest
from auto_dev.workflow_manager import Task


COVERAGE_COMMAND = f"""coverage report \
Expand Down Expand Up @@ -58,6 +59,9 @@ def test_path(
if multiple:
extra_args.extend(("-n", str(cpu_count())))

args = [path, *extra_args]
res = pytest.main(args)
return bool(res == 0)
args = ["pytest", path, *extra_args]
env = os.environ.copy()
env.update({"PYTHONPATH": "."})
task = Task(command=" ".join(args), env_vars=env)
task.work()
return not task.is_failed
Loading
Loading