You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate Wikipedia-API from unittest to pytest (#514)
* Switch to pytest
* Fix tox config
* Fix failing test for MacOS and Python 3.10
* Convert few more files
* Migrate test files from unittest to pytest
- Migrated 11 test files from unittest to pytest
- Converted unittest.TestCase classes to plain classes with pytest fixtures
- Replaced all self.assert* methods with standard assert statements
- Fixed pytest.raises usage and exception access patterns
- All tests passing successfully
Files migrated:
- query_errors_test.py
- query_submodules_test.py
- async_http_client_test.py
- async_wikipedia_page_test.py
- http_client_test.py
- wikipedia_test.py
- wikipedia_page_test.py
- wikipedia_page_section_test.py
- extract_wiki_format_test.py
- extract_html_format_test.py
- search_enums_test.py
* convert few more files
* fix another batch
Copy file name to clipboardExpand all lines: AGENTS.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,9 +219,9 @@ make html
219
219
make run-tests
220
220
```
221
221
222
-
This command runs both the unit tests and the CLI verification tests.
222
+
This command runs both the unit tests and CLI verification tests.
223
223
224
-
- The unit tests are executed via `python3 -m unittest discover tests/ '*test.py'`. All test files are in the `tests/` directory and follow the `*test.py` naming pattern.
224
+
- The unit tests are executed via `uv run pytest tests/`. All test files are in the `tests/` directory and follow the `*_test.py` naming pattern.
225
225
- The CLI verification tests are run using `./tests/cli/test_cli.sh verify`.
226
226
227
227
### CLI Tests
@@ -240,7 +240,7 @@ You can run the CLI tests independently.
240
240
make run-coverage
241
241
```
242
242
243
-
Produces a coverage report and `coverage.xml` for the `wikipediaapi` package.
243
+
Produces a coverage report and `coverage.xml` for the `wikipediaapi` package using pytest and pytest-cov.
Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ The main test command runs both unit tests and CLI verification tests::
62
62
63
63
make run-tests
64
64
65
-
* The unit tests are executed via ``python3 -m unittest discover tests/ '*test.py'``. All test files are in the ``tests/`` directory and follow the ``*test.py`` naming pattern.
65
+
* The unit tests are executed via ``uv run pytest tests/``. All test files are in the ``tests/`` directory and follow the ``*_test.py`` naming pattern.
66
66
* The CLI verification tests are run using ``./tests/cli/test_cli.sh verify``.
67
67
68
68
CLI Tests
@@ -83,6 +83,8 @@ Run tests with coverage to generate a coverage report and ``coverage.xml`` for t
83
83
84
84
make run-coverage
85
85
86
+
This uses pytest with pytest-cov to generate coverage reports.
0 commit comments