|
| 1 | +--- |
| 2 | +title: Week 5 |
| 3 | +layout: post |
| 4 | +description: null |
| 5 | +image: null |
| 6 | +gsoc_blog: true |
| 7 | +suburl: "2023/06/26/week_5.html" |
| 8 | +--- |
| 9 | + |
| 10 | +This week, I worked on completing an interesting PR that adds the [test function](https://github.com/codezonediitj/pydatastructs/pull/535) in pydatastructs. |
| 11 | +This will allow users to test multiple sub-modules, as well as the whole test suite of the library. For example, the following snippet shows |
| 12 | +the execution of `graphs` test also utilizing `pytest-xdist` that allows parallel tests execution: |
| 13 | + |
| 14 | +``` |
| 15 | +>>> import pydatastructs as pyds |
| 16 | +>>> pyds.test(['graphs'], n=4) |
| 17 | +============================= test session starts ============================== |
| 18 | +platform darwin -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0 |
| 19 | +rootdir: /Users/thebigbool/repos/pydatastructs |
| 20 | +plugins: cov-4.1.0, xdist-3.3.1, anyio-3.7.0 |
| 21 | +4 workers [11 items] |
| 22 | +........... [100%] |
| 23 | +============================== 11 passed in 0.41s ============================== |
| 24 | +``` |
| 25 | + |
| 26 | +One can also test using the module object directly using: |
| 27 | + |
| 28 | +``` |
| 29 | +>>> import pydatastructs as pyds |
| 30 | +>>> from pydatastructs import linear_data_structures as lds |
| 31 | +>>> pyds.test(lds) |
| 32 | +============================= test session starts ============================== |
| 33 | +platform darwin -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0 |
| 34 | +rootdir: /Users/thebigbool/repos/pydatastructs |
| 35 | +plugins: cov-4.1.0, xdist-3.3.1, anyio-3.7.0 |
| 36 | +collected 31 items |
| 37 | +
|
| 38 | +pydatastructs/linear_data_structures/tests/test_arrays.py ... [ 9%] |
| 39 | +pydatastructs/linear_data_structures/tests/test_linked_lists.py ..... [ 25%] |
| 40 | +pydatastructs/linear_data_structures/tests/test_algorithms.py .......... [ 58%] |
| 41 | +............. [100%] |
| 42 | +
|
| 43 | +============================== 31 passed in 0.10s ============================== |
| 44 | +``` |
0 commit comments