Three real issues surfaced when running the suite with strict warnings: 1. src/core/format_standardize.py: ``datetime.utcfromtimestamp`` is deprecated in CPython 3.12 and slated for removal. Replace with ``datetime.fromtimestamp(ts, tz=timezone.utc)``. Output for the date-only format codes we use is byte-identical. 2. src/core/io.py: ``list_sheets`` leaked the openpyxl file handle by returning ``xl.sheet_names`` from an unclosed ``pd.ExcelFile``. Wrap in a ``with`` block so the FD closes deterministically — also prevents the Windows-only "file is locked" repro path. 3. tests/test_corpus.py: ``TestXlsxPollution.workbook`` fixture returned the bare ``pd.ExcelFile`` instead of yielding + closing. Convert to a yield-and-finally pattern so the class-scoped handle isn't leaked across the whole test file. Also harden pytest.ini's warning policy: escalate ``ResourceWarning`` from ``src`` to an error, alongside the existing ``DeprecationWarning`` rule. Third-party warnings stay filtered — we can't fix pandas/openpyxl/streamlit churn from here. All 1916 tests pass under the strict filter; full and split runs (``pytest``, ``pytest -m 'not gui'``, ``pytest -m gui``) all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
990 B
INI
26 lines
990 B
INI
; pytest configuration shared by tox, run_tests.py, and direct pytest calls.
|
|
|
|
[pytest]
|
|
testpaths = tests
|
|
python_files = test_*.py
|
|
python_classes = Test*
|
|
python_functions = test_*
|
|
|
|
# Custom markers used by run_tests.py --quick and the e2e/install groupings.
|
|
markers =
|
|
slow: tests that take longer than ~1s (skipped under --quick)
|
|
e2e: end-to-end CLI / integration tests
|
|
install: import / dependency sanity tests
|
|
fixture_sweep: parametrized sweep over the test-cases/ folder
|
|
gui: Streamlit AppTest-driven tests (live in tests/gui/)
|
|
|
|
# Warnings discipline: fail on any DeprecationWarning *or* ResourceWarning
|
|
# from our own ``src`` package so a leaked file handle or stale stdlib call
|
|
# can't slip in unnoticed. Tolerate third-party deprecations / resource
|
|
# warnings — we can't fix pandas / openpyxl / streamlit churn from here.
|
|
filterwarnings =
|
|
error::DeprecationWarning:src
|
|
error::ResourceWarning:src
|
|
ignore::DeprecationWarning
|
|
ignore::ResourceWarning
|