You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then you will need to add to your `setup.cfg` or `.coveragerc` file
31
+
Then you will need to add to your `setup.cfg` or `.coveragerc` file
32
32
some extra configuration:
33
33
34
34
```ini
@@ -73,20 +73,20 @@ rules =
73
73
74
74
```
75
75
76
-
When running tests with and without `django` installed
76
+
When running tests with and without `django` installed
77
77
you will have `100%` coverage in both cases.
78
78
79
-
But, different lines will be included.
80
-
With `django` installed it will include
79
+
But, different lines will be included.
80
+
With `django` installed it will include
81
81
both `try:` and `if django is not None:` conditions.
82
82
83
83
When running without `django` installed,
84
84
it will include `except ImportError:` line.
85
85
86
86
87
-
## Writting pragma rules
87
+
## Writing pragma rules
88
88
89
-
Format for pragma rules is:
89
+
Format for pragma rules is:
90
90
91
91
```
92
92
"pragma-condition": pragma-name
@@ -96,16 +96,24 @@ Code inside `"pragma-condition"` is evaluted with `eval`.
96
96
Make sure that the input you pass there is trusted!
97
97
`"pragma-condition"` must return `bool` value after evaluation.
98
98
99
-
We also provide a bunch of helpers to make writing rules easier:
99
+
We support all environment markers specified in [PEP-496](https://www.python.org/dev/peps/pep-0496/).
100
+
See [Strings](https://www.python.org/dev/peps/pep-0496/#strings)
101
+
and [Version Numbers](https://www.python.org/dev/peps/pep-0496/#version-numbers)
102
+
sections for available values. Also, we provide a bunch of additional markers:
100
103
101
104
-`sys_version_info` is the same as [`sys.version_info`](https://docs.python.org/3/library/sys.html#sys.version_info)
102
-
-`os_name` is the same as [`os.name`](https://docs.python.org/3/library/os.html#os.name)
103
105
-`os_environ` is the same as [`os.environ`](https://docs.python.org/3/library/os.html#os.environ)
104
-
-`platform_system` is the same as [`platform.system()`](https://docs.python.org/3/library/platform.html#platform.system)
105
-
-`platform_release` is the same as [`platform.release()`](https://docs.python.org/3/library/platform.html#platform.release)
106
106
-`is_installed` is our custom function that tries to import the passed string, returns `bool` value
107
107
-`package_version` is our custom function that tries to get package version from `pkg_resources` and returns its [parsed version](https://packaging.pypa.io/en/latest/version/#packaging.version.parse)
108
108
109
+
Use `get_env_info` to get values for the current environment:
110
+
111
+
```python
112
+
from coverage_conditional_plugin import get_env_info
0 commit comments