Skip to content

Migrate selftests to pytest - #36

Merged
jserv merged 1 commit into
mainfrom
pytest
Feb 18, 2026
Merged

jserv merged 1 commit into
mainfrom
pytest

Conversation

@jserv

@jserv jserv commented Feb 18, 2026 •

Copy link
Copy Markdown
Contributor

This moves selftests into 10 focused pytest modules under 'tests', with shared fixtures and helpers in tests/conftest.py. Original testsuite.py now delegates selftests to pytest and retains only kernel compatibility tests.

  • Add pytest.ini with testpaths and compat marker
  • Add tests/conftest.py with shared fixtures and assertion helpers (verify_value, assign_and_verify, verify_str, etc.)
  • Split inline tests into test_{symbols,repr,expressions,semantics, properties,deps,config_io,lexer,preprocess,compat}
  • Update CI workflow to run pytest selftests as a separate step

It also removes testsuite.py in favor of pytest test modules.


Summary by cubic

Migrated self-tests to pytest with shared fixtures, expanded coverage, and removed deprecated APIs. Compat tests are pytest-marked and run only from a Linux kernel tree; CI and README updated.

  • Refactors

    • Split self-tests into 10 pytest modules under tests/ with shared fixtures/helpers in tests/conftest.py; added pytest.ini with a compat marker; compat tests live in tests/test_compat.py.
    • Removed testsuite.py; README updated; tests/reltest now runs only compat tests and example scripts from a kernel tree; CI runs platform-appropriate pytest suites (Windows: headless + menuconfig import only; Linux/macOS: self-tests, compat tests, and examples).
    • Expanded coverage for public APIs: expr_value(), Symbol.config_string, Symbol.rev_dep/weak_rev_dep, Kconfig.missing_syms, and Symbol.user_loc.
    • Inlined load_allconfig into Kconfig.load_allconfig and removed deprecated APIs: KconfigSyntaxError alias, InternalError, and enable_/disable_ warning methods.
  • Migration

    • Run self-tests: python -m pytest tests/ -v
    • Skip compat tests: python -m pytest -m "not compat"
    • Run compat tests from a kernel tree: cd /path/to/linux && python -m pytest Kconfiglib/tests/test_compat.py -v

Written for commit 4790d62. Summary will update on new commits.

cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv
jserv force-pushed the pytest branch 2 times, most recently from 9ae8764 to 7edddd1 Compare February 18, 2026 04:34
This replaces testsuite.py with pytest modules under 'tests/' directory.
Add conftest.py with shared fixtures.

It removes deprecated APIs: KconfigSyntaxError alias, InternalError
exception, enable_/disable_ warning methods, and load_allconfig (inlined
into Kconfig.load_allconfig() method).

Add tests for previously-untested public APIs: expr_value(),
Symbol.config_string, Symbol.rev_dep, Symbol.weak_rev_dep,
Kconfig.missing_syms, and Symbol.user_loc.
@jserv
jserv merged commit b9e3a54 into main Feb 18, 2026
9 checks passed
@jserv
jserv deleted the pytest branch February 18, 2026 05:24
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.

1 participant