File: README.md

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (60 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
pytest test coverage for the GenerateWebIDLBindings.py script
=============================================================

This directory contains tests for the GenerateWebIDLBindings.py script,
which is used to parse the WebExtensions APIs schema files and generate
the corresponding WebIDL definitions.

See ["WebIDL WebExtensions API Bindings" section from the Firefox Developer documentation](https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html)
for more details about how the script is used, this README covers only how
this test suite works.

Run tests
---------

The tests part of this test suite can be executed locally using the following `mach` command:

```
mach python-test toolkit/components/extensions/webidl-api/test
```

Write a new test file
---------------------

To add a new test file to this test suite:
- create a new python script file named as `test_....py`
- add the test file to the `python.ini` manifest
- In the new test file make sure to include:
  - copyright notes as the other test file in this directory
  - import the helper module and call its `setup()` method (`setup` makes sure to add
    the directory where the target script is in the python library paths and the
    `helpers` module does also enable the code coverage if the environment variable
    is detected):
    ```
    import helpers  # Import test helpers module.
    ...

    helpers.setup()
    ```
  - don't forget to call `mozunit.main` at the end of the test file:
    ```
    if __name__ == "__main__":
        mozunit.main()
    ```
  - add new test cases by defining new functions named as `test_...`,
    its parameter are the names of the pytest fixture functions to
    be passed to the test case:
    ```
    def test_something(base_schema, write_jsonschema_fixtures):
        ...
    ```
Create new test fixtures
------------------------

All the test fixture used by this set of tests are defined in `conftest.py`
and decorated with `@pytest.fixture`.

See the pytest documentation for more details about how the pytest fixture works:
- https://docs.pytest.org/en/latest/explanation/fixtures.html
- https://docs.pytest.org/en/latest/how-to/fixtures.html
- https://docs.pytest.org/en/latest/reference/fixtures.html