diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 7a0ae18e4..9e922c218 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -87,7 +87,7 @@ jobs: ENV: stage PRODUCT_ID: ${{ secrets.STAGE_PRODUCT_ID }} - run: python -m pytest -r fE -x --cov-branch --cov=./ --cov-report=lcov:coverage/lcov.info + run: python -m pytest --cov-branch --cov=./ --cov-report=lcov:coverage/lcov.info - name: Check resources on failure if: failure() diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..82b80f1ca --- /dev/null +++ b/pytest.ini @@ -0,0 +1,16 @@ +[pytest] +addopts = + -n auto + --dist loadgroup + --maxfail=5 + -rfE + +# Options explained: +# -n auto: Run tests in parallel using all CPU cores +# --dist loadgroup: Group related tests together for better parallel execution +# --maxfail=5: Stop after 5 test failures instead of continuing +# -r fE: Show summary of only failures and errors (not passed/skipped) +testpaths = . +python_files = test_*.py *_test.py +python_classes = Test* +python_functions = test_* diff --git a/requirements.txt b/requirements.txt index ae922581b..2dc9ba938 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,6 +30,7 @@ distro==1.9.0 dnspython==2.6.1 email_validator==2.2.0 exceptiongroup==1.2.2 +execnet==2.1.2 Faker==24.14.1 fastapi==0.115.12 fastapi-cli==0.0.5 @@ -93,6 +94,7 @@ pyright==1.1.405 pytest==8.3.3 pytest-asyncio==0.26.0 pytest-cov==6.0.0 +pytest-xdist==3.8.0 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-multipart==0.0.20 diff --git a/services/github/templates/add_issue_templates.py b/services/github/templates/add_issue_templates.py index ac123bde1..4a9986147 100644 --- a/services/github/templates/add_issue_templates.py +++ b/services/github/templates/add_issue_templates.py @@ -59,7 +59,11 @@ def add_issue_templates(full_name: str, installer_name: str, token: str) -> None # Get the list of existing files in the user's remote repository at the GITHUB_ISSUE_DIR. We need to use try except as repo.get_contents() raises a 404 error if the directory doesn't exist. Also directory path MUST end without a slash. try: remote_files_result = repo.get_contents(path=GITHUB_ISSUE_DIR) - remote_files: list[ContentFile] = remote_files_result if isinstance(remote_files_result, list) else [remote_files_result] + remote_files: list[ContentFile] = ( + remote_files_result + if isinstance(remote_files_result, list) + else [remote_files_result] + ) remote_file_names: list[str] = [file.name for file in remote_files] except Exception: # pylint: disable=broad-except remote_file_names = []