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
6 changes: 3 additions & 3 deletions .github/workflows/python-mutation-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
Expand All @@ -24,7 +24,7 @@ jobs:
- run: poodle --html mutation_reports
- name: Upload Report HTML
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Mutation testing report HTML
path: mutation_reports
6 changes: 3 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
py: ['3.8','3.9','3.10','3.11','3.12']
py: ['3.9','3.10','3.11','3.12','3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Install Dependencies and Tools
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/python-test-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
Expand All @@ -32,13 +32,13 @@ jobs:
- run: pytest --cov=src --cov-report=json:code-coverage.json
- name: artifact-html-report
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Coverage Report HTML
path: cov-html
- name: artifact-json-report
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Coverage Report JSON
path: code-coverage.json
Expand All @@ -47,9 +47,9 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
Expand All @@ -63,9 +63,9 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
Expand All @@ -89,16 +89,14 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r req/requirements.txt --upgrade
pip install -r req/mypy.txt --upgrade
- run: mypy --python-version 3.8
if: ${{ always() }}
- run: mypy --python-version 3.9
if: ${{ always() }}
- run: mypy --python-version 3.10
Expand All @@ -107,6 +105,8 @@ jobs:
if: ${{ always() }}
- run: mypy --python-version 3.12
if: ${{ always() }}
- run: mypy --python-version 3.13
if: ${{ always() }}
ruff:
name: Linter Checks with Ruff
runs-on: [ubuntu-latest]
Expand All @@ -116,7 +116,7 @@ jobs:
uses: chartboost/ruff-action@v1
with:
src: src
args: check --show-source
args: check --show-files
- name: Ruff src diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
Expand All @@ -128,7 +128,7 @@ jobs:
if: ${{ always() }}
with:
src: test
args: check --show-source
args: check --show-files
- name: Ruff test diff
uses: chartboost/ruff-action@v1
if: ${{ always() }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/update-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
Expand All @@ -35,15 +35,15 @@ jobs:
message: ':robot: Update Coverage Report'
- name: artifact-html-report
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Coverage Report
path: cov-html
- name: Poodle
run: poodle --json mutation-testing-report.json --html html-report
- name: Upload Report HTML
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Mutation testing report HTML
path: html-report
Expand Down
90 changes: 0 additions & 90 deletions mutmut.ipynb

This file was deleted.

4 changes: 0 additions & 4 deletions mutmut_config.py

This file was deleted.

34 changes: 19 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ command_line = "pytest -x --assert=plain -o pythonpath='{PYTHONPATH}' --sort-mod

[tool.black]
line-length = 120
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
skip-string-normalization = true
color = true

Expand All @@ -76,19 +76,8 @@ files = "src"
mypy_path = "src"

[tool.ruff]
target-version = "py38"
show-source = true
select = ["ALL"]
ignore = [
"ANN101", # Missing type annotation for self in method
"COM812", # missing-trailing-comma
"D203", # 1 blank line required before class docstring
"D213", # multi-line-summary-second-line
"EM101", # Exception must not use a string literal, assign to variable first
"ISC001", # single-line-implicit-string-concatenation
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"TRY003", # Avoid specifying long messages outside the exception class
]
target-version = "py39"
output-format = "full"
line-length = 120
exclude = [
".eggs",
Expand All @@ -104,10 +93,25 @@ exclude = [
"venv",
]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"COM812", # missing-trailing-comma
"D203", # 1 blank line required before class docstring
"D213", # multi-line-summary-second-line
"EM101", # Exception must not use a string literal, assign to variable first
"ISC001", # single-line-implicit-string-concatenation
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"TRY003", # Avoid specifying long messages outside the exception class
]

[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = true

[tool.ruff.lint.isort]
known-first-party = ["pytest_sort"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"src/pytest_sort/core.py" = [
"ARG005", # Unused lambda argument
"T201", # print found
Expand Down
3 changes: 2 additions & 1 deletion req/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ isort

-r pytest.txt
-r mypy.txt
-r build.txt
-r build.txt
-r poodle.txt
7 changes: 2 additions & 5 deletions src/pytest_sort/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import hashlib
import random
import sys
from functools import partial
from typing import TYPE_CHECKING, Any, Callable

Expand All @@ -15,9 +14,7 @@
from pytest_sort.database import get_all_totals, get_stats
from pytest_sort.diffcov import get_diff_test_scores, get_mut_test_scores

md5: Callable = hashlib.md5
if sys.version_info >= (3, 9):
md5: Callable = partial(hashlib.md5, usedforsecurity=False) # type: ignore[no-redef]
md5: Callable = partial(hashlib.md5, usedforsecurity=False) # type: ignore[no-redef]


if TYPE_CHECKING:
Expand Down Expand Up @@ -254,7 +251,7 @@ def print_recorded_times_report(terminal_reporter: TerminalReporter) -> None:

print(
f"\n*** {'pytest-sort maximum recorded times'.ljust(node_id_width)}"
f"{'Nanoseconds'.center(stat_width*4 - 4)} ***",
f"{'Nanoseconds'.center(stat_width * 4 - 4)} ***",
)
print(
f"{'Test Case'.ljust(node_id_width)} {'setup'.rjust(stat_width)} "
Expand Down
20 changes: 4 additions & 16 deletions src/pytest_sort/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,12 @@ def update_test_cases(recorded_times: dict) -> None:
"""Update Test Case Data with specfiied duration(s) and recalculate total(s)."""
_load_data()

for nodeid in recorded_times:
for nodeid, recorded_node in recorded_times.items():
node_data = _sort_data.get(nodeid, {})

node_data["setup"] = node_data.get("setup", 0)
node_data["call"] = node_data.get("call", 0)
node_data["teardown"] = node_data.get("teardown", 0)

setup = recorded_times[nodeid].get("setup", 0)
if node_data["setup"] < setup:
node_data["setup"] = setup

call = recorded_times[nodeid].get("call", 0)
if node_data["call"] < call:
node_data["call"] = call

teardown = recorded_times[nodeid].get("teardown", 0)
if node_data["teardown"] < teardown:
node_data["teardown"] = teardown
node_data["setup"] = max(node_data.get("setup", 0), recorded_node.get("setup", 0))
node_data["call"] = max(node_data.get("call", 0), recorded_node.get("call", 0))
node_data["teardown"] = max(node_data.get("teardown", 0), recorded_node.get("teardown", 0))

node_data["total"] = node_data["setup"] + node_data["call"] + node_data["teardown"]

Expand Down
Loading