Skip to content

test: restructure suite — shared conftest, markers, drop dead tests, error.py coverage#107

Merged
martinkersner merged 6 commits into
mainfrom
issue-106-restructure-test-suite
Jun 30, 2026
Merged

test: restructure suite — shared conftest, markers, drop dead tests, error.py coverage#107
martinkersner merged 6 commits into
mainfrom
issue-106-restructure-test-suite

Conversation

@martinkersner

Copy link
Copy Markdown
Member

Summary

Restructures the test suite per #106. Most of the original issue was already
addressed by prior PRs (#101 added granular responses-mocked keyless tests
covering validation + liquidation/open-interest/error; #96/#103/#105 set up the
keyless CI lane). This PR closes the remaining gaps:

  • Shared tests/conftest.py — moves the datamaxi/telegram/naver
    fixtures, API_KEY/BASE_URL resolution, and _FLAKY_PROD_DATA_XFAIL marker
    (previously copy-pasted verbatim) into one place. tests/__init__.py added so
    from tests.conftest import ... resolves to pytest's single conftest instance.
  • Markers — register integration + smoke, drop now-unused errors,
    enable --strict-markers. Live lanes are marked so the keyless CI lane
    deselects them by marker.
  • CI — keyless lane now selects by marker: pytest tests/ -m "not integration"
    (was -k "not integration"). Runs keyless, no network, across the existing
    py3.10–3.14 matrix.
  • Dead code removed — no-op test_invalid_exchange/test_invalid_symbol
    (except (ValueError, Exception): pass, asserts nothing) and the duplicate
    test_candle_with_from_unix (identical args to test_candle_with_from_and_to_unix).
  • tests/test_error.py — direct unit coverage for error.py
    (ClientError/ServerError field storage, ParameterRequired / AtLeastOneParameter
    message formatting), which was only exercised indirectly before.

Note: tests/util.py::mock_http_response is NOT removed — the issue called it
dead, but #101 now uses it across ~12 test modules.

Test plan

  • Keyless lane exactly as CI runs it, no key, no network:
    env -u DATAMAXI_API_KEY python -m pytest tests/ -m "not integration" -q
    113 passed, 11 skipped, 116 deselected.
  • Full collection with no key: python -m pytest --collect-only -q → 240 collected, no import errors.
  • black --check . and flake8 . --statistics both clean.
  • Live integration/smoke lanes not run (no key; hit prod) but collect cleanly.

Closes #106

- add tests/conftest.py: datamaxi/telegram/naver fixtures, API_KEY/BASE_URL,
  _FLAKY_PROD_DATA_XFAIL; remove copy-paste from test_call/test_integration
- register integration/smoke markers; --strict-markers; drop unused errors
- mark live lanes (integration/smoke) so keyless CI deselects via -m
- drop no-op TestErrorHandling + duplicate test_candle_with_from_unix
@martinkersner martinkersner self-assigned this Jun 30, 2026
@martinkersner martinkersner merged commit e526220 into main Jun 30, 2026
2 checks passed
@martinkersner martinkersner deleted the issue-106-restructure-test-suite branch June 30, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restructure test suite: run keyless tests in CI, dedupe fixtures, drop dead code, fill coverage gaps

1 participant