@@ -13,7 +13,7 @@ There is a template in this directory called `tox.jinja` which contains a
1313combination of hardcoded and generated entries.
1414
1515The ` populate_tox.py ` script fills out the auto-generated part of that template.
16- It does this by querying PYPI for each framework's package and its metadata and
16+ It does this by querying PyPI for each framework's package and its metadata and
1717then determining which versions make sense to test to get good coverage.
1818
1919The lowest supported and latest version of a framework are always tested, with
@@ -48,7 +48,20 @@ integration_name: {
4848}
4949```
5050
51- The following can be set as a rule:
51+ ### ` package `
52+
53+ The name of the third party package as it's listed on PyPI. The script will
54+ be picking different versions of this package to test.
55+
56+ This key is mandatory.
57+
58+ ### ` deps `
59+
60+ The test dependencies of the test suite. They're defined as a dictionary of
61+ ` rule: [package1, package2, ...] ` key-value pairs. All packages
62+ in the package list of a rule will be installed as long as the rule applies.
63+
64+ ` rule ` s are predefined. Each ` rule ` must be one of the following:
5265 - ` * ` : packages will be always installed
5366 - a version specifier on the main package (e.g. ` <=0.32 ` ): packages will only
5467 be installed if the main package falls into the version bounds specified
@@ -60,53 +73,61 @@ package's dependencies, for example. If e.g. Flask tests generally need
6073Werkzeug and don't care about its version, but Flask older than 3.0 needs
6174a specific Werkzeug version to work, you can say:
6275
63- ```
76+ ``` python
6477" flask" : {
6578 " deps" : {
6679 " *" : [" Werkzeug" ],
6780 " <3.0" : [" Werkzeug<2.1.0" ],
68- }
69- }
70- ```
71-
72- Sometimes, things depend on the Python version installed. If the integration
73- test should only run on specific Python version, e.g. if you want AIOHTTP
74- tests to only run on Python 3.7+, you can say:
75-
76- ```
77- "aiohttp": {
81+ },
7882 ...
79- "python": ">=3.7",
8083}
8184```
8285
83- If, on the other hand, you need to install a specific version of a secondary
84- dependency on specific Python versions (so the test suite should still run on
85- said Python versions, just with different dependency-of-a-dependency bounds),
86- you can say:
86+ If you need to install a specific version of a secondary dependency on specific
87+ Python versions, you can say:
8788
88- ```
89+ ``` python
8990" celery" : {
90- ...
9191 " deps" : {
9292 " *" : [" newrelic" , " redis" ],
9393 " py3.7" : [" importlib-metadata<5.0" ],
9494 },
95- },
95+ ...
96+ }
97+ ```
98+
99+ ### ` python `
100+
101+ Sometimes, the whole test suite should only run on specific Python versions.
102+ This can be achieved via the ` python ` key, which expects a version specifier.
103+
104+ For example, if you want AIOHTTP tests to only run on Python 3.7+, you can say:
105+
106+ ``` python
107+ " aiohttp" : {
108+ " python" : " >=3.7" ,
109+ ...
110+ }
96111```
97112
113+ Specifying ` python ` is discouraged as the script itself finds out which
114+ Python versions are supported by the package. However, if a package has broken
115+ metadata or the SDK is explicitly not supporting some packages on specific
116+ Python versions (because of, for example, broken context vars), the ` python `
117+ key can be used.
118+
119+
98120## How-Tos
99121
100122### Add a new test suite
101123
1021241 . Add the minimum supported version of the framework/library to ` _MIN_VERSIONS `
103125 in ` integrations/__init__.py ` . This should be the lowest version of the
104126 framework that we can guarantee works with the SDK. If you've just added the
105- integration, it's fine to set this to the latest version of the framework
127+ integration, you should generally set this to the latest version of the framework
106128 at the time.
1071292 . Add the integration and any constraints to ` TEST_SUITE_CONFIG ` . See the
108- "Defining constraints" section for the format (or copy-paste one
109- of the existing entries).
130+ "Defining constraints" section for the format.
1101313 . Add the integration to one of the groups in the ` GROUPS ` dictionary in
111132 ` scripts/split_tox_gh_actions/split_tox_gh_actions.py ` .
1121334 . Add the ` TESTPATH ` for the test suite in ` tox.jinja ` 's ` setenv ` section.
0 commit comments