[riot-notifications] [RIOT-OS/RIOT] tests/posix_semaphore: private sub functions for tests libs (#10831)

Gaëtan Harter notifications at github.com
Mon Jan 21 12:47:11 CET 2019


### Contribution description

While trying python test libraries, like pytest, the automatic test collection
detects the `testNUM` functions as tests but does not know the `term` argument
and fails.

This declares them as private to only find `testfunc(child)` entry point.

Another solution could have been to use `testNUM(child)` and rename
`testfunc` to `main` but would not match other tests.

It is required for the board tests on `iot-lab` CI.

### Testing procedure

The current tests should still work in master and have the same result.

    BOARD=samr21-xpro make -C tests/posix_semaphore/ all flash test

I tested and got `TEST1` to `TEST4` on both `native` and `samr21-xpro`.

#### Fixed bug

To test that it addresses the described issue, it can be used with https://github.com/cladmi/iotlab-os-ci/tree/master/tools/pytest

It works with the PR but not in master.

```
RIOT_MAKEFILES_GLOBAL_POST=iotlab-os-ci/tools/pytest/pytest.mk.post BOARD=samr21-xpro make -C tests/posix_semaphore/ all flash pytest
...
File /home/harter/work/git/RIOT/tests/posix_semaphore/tests/01-run.py, line 13
  def test1(term):
E       fixture 'term' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, child, doctest_namespace, metadata, monkeypatch, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
```

A special handling could be done for this case but it is the only test where it happens.

### Issues/PRs references

Found while preparing release tests to run on IoT-LAB.
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10831

-- Commit Summary --

  * tests/posix_semaphore: private sub functions for tests libs

-- File Changes --

    M tests/posix_semaphore/tests/01-run.py (16)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10831.patch
https://github.com/RIOT-OS/RIOT/pull/10831.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10831
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190121/7a6013a7/attachment.html>


More information about the notifications mailing list