@@ -71,9 +71,11 @@ those who use PyTest, when using PyScript.
7171 modules.
72727 . The ` result ` of awaiting ` upytest.run ` is a Python dictionary containing
7373 lists of tests bucketed under the keys: ` "passes" ` , ` "fails" ` and
74- ` "skipped" ` . These results are JSON serializable and can be used for further
75- processing and analysis (again, see ` main.py ` for an example of this in
76- action.)
74+ ` "skipped" ` . The result also provides information about the Python
75+ interpreter used to run the tests, long with a boolean flag to indicate if
76+ the tests were running in a web worker. These results are JSON serializable
77+ and can be used for further processing and analysis (again, see ` main.py `
78+ for an example of this in action.)
77798 . In your ` index.html ` make sure you use the ` terminal ` attribute
7880 when referencing your Python script (as in the ` index.html ` file in
7981 this repository):
@@ -83,7 +85,7 @@ those who use PyTest, when using PyScript.
8385 You should be able to use the ` type ` attribute of ` "mpy" ` (for MicroPython)
8486 and ` "py" ` (for Pyodide) interchangeably.
8587
86- Finally, point your browser at your ` index.html ` and your should see the test
88+ Finally, point your browser at your ` index.html ` and you should see the test
8789suite run.
8890
8991### Writing tests
@@ -208,68 +210,41 @@ The output for the test suite for this module is a good example of all the
208210different sorts of information you may see:
209211
210212```
211- Python interpreter: webassembly 3.4.0; MicroPython v1.24.0-preview.114.g77bd8fe5b on 2024-07-19
212- Using ./tests/conftest.py for global setup and teardown in ./tests.
213- Using local setup and teardown for ./ tests/test_with_setup_teardown .py.
214- Found 2 test module[s]. Running 18 test[s].
213+ Python interpreter: webassembly 3.4.0; MicroPython v1.24.0-preview.114.g77bd8fe5b on 2024-07-19
214+ Running in worker: False
215+ Using tests/conftest.py for global setup and teardown in tests/test_core_functionality .py::TestClass .
216+ Found 1 test module[s]. Running 8 test[s].
215217
216- S.F..FFFS..S.F.SF .
218+ F.FSSF. .
217219================================= FAILURES =================================
218- Failed: ./ tests/test_core_functionality.py::test_does_not_raise_exception_fails
220+ Failed: tests/test_core_functionality.py::TestClass. test_does_not_raise_exception_fails
219221Traceback (most recent call last):
220- File "upytest.py", line 147 , in run
221- File "tests/test_core_functionality.py", line 77 , in test_does_not_raise_exception_fails
222+ File "upytest.py", line 156 , in run
223+ File "tests/test_core_functionality.py", line 127 , in test_does_not_raise_exception_fails
222224AssertionError: Did not raise expected exception. Expected ValueError; but got None.
223225
224226
225- Failed: ./ tests/test_core_functionality.py::test_fails
227+ Failed: tests/test_core_functionality.py::TestClass. test_fails
226228Traceback (most recent call last):
227- File "upytest.py", line 147 , in run
228- File "tests/test_core_functionality.py", line 46 , in test_fails
229+ File "upytest.py", line 156 , in run
230+ File "tests/test_core_functionality.py", line 119 , in test_fails
229231AssertionError: This test will fail
230232
231233
232- Failed: ./tests/test_core_functionality.py::test_async_does_not_raise_exception_fails
233- Traceback (most recent call last):
234- File "upytest.py", line 145, in run
235- File "tests/test_core_functionality.py", line 121, in test_async_does_not_raise_exception_fails
236- AssertionError: Did not raise expected exception. Expected ValueError; but got None.
237-
238-
239- Failed: ./tests/test_core_functionality.py::test_async_does_not_raise_expected_exception_fails
240- Traceback (most recent call last):
241- File "upytest.py", line 145, in run
242- File "tests/test_core_functionality.py", line 126, in test_async_does_not_raise_expected_exception_fails
243- AssertionError: Did not raise expected exception. Expected ValueError, AssertionError; but got TypeError.
244-
245-
246- Failed: ./tests/test_core_functionality.py::test_does_not_raise_expected_exception_fails
234+ Failed: tests/test_core_functionality.py::TestClass.test_does_not_raise_expected_exception_fails
247235Traceback (most recent call last):
248- File "upytest.py", line 147 , in run
249- File "tests/test_core_functionality.py", line 85 , in test_does_not_raise_expected_exception_fails
236+ File "upytest.py", line 156 , in run
237+ File "tests/test_core_functionality.py", line 131 , in test_does_not_raise_expected_exception_fails
250238AssertionError: Did not raise expected exception. Expected ValueError, AssertionError; but got TypeError.
251239
252-
253- Failed: ./tests/test_core_functionality.py::test_async_fails
254- Traceback (most recent call last):
255- File "upytest.py", line 145, in run
256- File "tests/test_core_functionality.py", line 111, in test_async_fails
257- AssertionError: This async test fails.
258-
259240================================= SKIPPED ==================================
260- Skipped: ./tests/test_core_functionality.py::test_when_skipped
261- Reason: This test will be skipped with a when condition
262-
263- Skipped: ./tests/test_core_functionality.py::test_async_when_skipped
264- Reason: This test will be skipped with a when condition
265-
266- Skipped: ./tests/test_core_functionality.py::test_async_skipped
267- Reason: This async test will be skipped
268-
269- Skipped: ./tests/test_core_functionality.py::test_skipped
241+ Skipped: tests/test_core_functionality.py::TestClass.test_skipped
270242Reason: This test will be skipped
243+
244+ Skipped: tests/test_core_functionality.py::TestClass.test_when_skipped
245+ Reason: This test will be skipped with a skip_when condition
271246========================= short test summary info ==========================
272- 6 failed, 4 skipped, 8 passed in 0.00 seconds
247+ 3 failed, 2 skipped, 3 passed in 0.00 seconds
273248```
274249
275250## Developer setup
0 commit comments