@@ -4,7 +4,7 @@ To run all tests and all supported static analysis tools, Python 3.11 is needed,
4
4
which matches the current Python version of XenServer 9.
5
5
6
6
Python 3.10 might work as well (when replacing the references in the config files with 3.10).
7
- Python 3.12 and 3.13 can be used too, but not for running [ pytype] ( https://github.com/google/pytype )
7
+ Python 3.12 and 3.13 can be used too, but not for running [ ` pytype ` ] ( https://github.com/google/pytype )
8
8
([ it does not support 3.12 yet] ( https://google.github.io/pytype/support.html ) ).
9
9
10
10
On Ubuntu, you can install 3.11 (and also 3.12 and 3.13) from the widely-used Python support PPA:
@@ -14,19 +14,19 @@ sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt update
14
14
sudo apt install -y python3.11 python3.12 python3.13
15
15
```
16
16
17
- If 3.12 or 3.13 are found by [ tox] ( https://tox.wiki ) , it will run the unit tests with them as well.
17
+ If 3.12 or 3.13 are found by [ ` tox ` ] ( https://tox.wiki ) , it will run the unit tests with them as well.
18
18
19
- You can also use [ uv to install Python versions] ( https://docs.astral.sh/uv/concepts/python-versions ) ,
20
- see below on a link and an example how to install uv .
19
+ You can also use [ ` uv ` to install Python versions] ( https://docs.astral.sh/uv/concepts/python-versions ) ,
20
+ see below on a link and an example how to install ` uv ` .
21
21
22
- ## Do not use distro-privided Python CI tools
22
+ ## Do not use distro-provided Python CI tools
23
23
24
- Python tools (other than the Python interpreters themself ) provided by Linux distributions
24
+ Python tools (other than the Python interpreters themselves ) provided by Linux distributions
25
25
are "always" out of date and do not work as required. If possible, uninstall/remove those,
26
26
even if your environment is based on Ubuntu 24.04. In addition, most problematically, the
27
- distribution-provided Python tools are running using the default Pyton version of the
27
+ distribution-provided Python tools are running using the default Python version of the
28
28
host system, which may not be compatible and can cause subtle errors. (e.g. Python 3.12
29
- or newer triggers unclear dependency errors in pytype because it is not supported yet)
29
+ or newer triggers unclear dependency errors in ` pytype ` because it is not supported yet)
30
30
31
31
## Create a virtual environment with the test dependencies
32
32
@@ -55,21 +55,21 @@ pip-compile --extra=test,mypy,pyright,pytype,tox -o - pyproject.toml | pip insta
55
55
56
56
These commands assume you installed the tools using the commands above in a Python 3.11 environment.
57
57
58
- ### Run pyright, watching for changes and automatically checking the change
58
+ ### Run ` pyright ` , watching for changes and automatically checking the change
59
59
60
60
``` sh
61
61
pyright -w
62
62
```
63
63
64
- ### Run pytest with coverage (fine-grained, e.g. during test development)
64
+ ### Run ` pytest ` with coverage (fine-grained, e.g. during test development)
65
65
66
66
``` sh
67
67
pytest --cov -v --new-first -x --show-capture=all -rA [optional: files / select which tests to run]
68
68
` ` `
69
69
70
70
# ## Watching and running tests on changes automatically using `pytest-watch` (`ptw`)
71
71
72
- Install ptw in the Python environment using:
72
+ Install ` ptw` in the Python environment using:
73
73
74
74
` ` ` sh
75
75
pip install pytest-watch
@@ -82,25 +82,25 @@ Run `ptw`, and pass the files to watch, e.g.:
82
82
ptw tests/test_*
83
83
` ` `
84
84
85
- # ## Run mypy (fine-grained, e.g. during development)
85
+ # ## Run ` mypy` (fine-grained, e.g. during development)
86
86
87
87
` ` ` sh
88
88
mypy [optionally pass the flags or files to select which tests to run]
89
89
` ` `
90
90
91
- # ## Run pylint (fine-grained, e.g. during development)
91
+ # ## Run ` pylint` (fine-grained, e.g. during development)
92
92
93
93
` ` ` sh
94
94
pylint xcp tests [optionally pass the flags or files to select which tests to run]
95
95
` ` `
96
96
97
- # ## Run all of the above on one go in defined virtual environments
97
+ # ## Run all the above on one go in defined virtual environments
98
98
99
99
` ` ` sh
100
100
tox -e py311-cov-check-lint-mdreport
101
101
` ` `
102
102
103
- This also checks code coverage and ends with a test report from the pytest run.
103
+ This also checks code coverage and ends with a test report from the ` pytest` run.
104
104
If you just run ` tox` without arguments, in addition, the unit tests are run with
105
105
all installed Python versions (out of the list of 3.11, 3.12 and 3.13)
106
106
@@ -112,7 +112,7 @@ To run all tests, including trailing whitespace checks, run
112
112
pre-commit run -av
113
113
` ` `
114
114
115
- # # Alternative: installing pytest packages using `pipx`
115
+ # # Alternative: Install ` pytest` packages using `pipx`
116
116
117
117
` pipx` installs tools in ` ~/.local/share/pipx/venvs` which can be an alternate
118
118
way to install up-to-date python tools
@@ -128,7 +128,7 @@ pipx inject pylint pyfakefs six mock pytest{,_forked,-localftpserver}
128
128
129
129
For consistently well-spaced documentation, all Markdown files are checked
130
130
in CI using Markdownlint, which ensures that e.g. code blocks are separated
131
- by space from the preceeding and following paragraphs and so on. This helps
131
+ by space from the preceding and following paragraphs and so on. This helps
132
132
to keep the Markdown source as well-readable as the rendered Markdown.
133
133
134
134
To check and fix Markdown files quickly, use:
@@ -137,7 +137,7 @@ To check and fix Markdown files quickly, use:
137
137
pre-commit run -av markdownlint
138
138
` ` `
139
139
140
- # ## Removing trailing whitepace and fixing files to have only one trailing newline
140
+ # ## Removing trailing whitespace and fixing files to have only one trailing newline
141
141
142
142
These fixers detect and fix trailing whitespace and trailing newlines in files
143
143
to keep commits clean of adding trailing whitespace and are used in GitHub CI:
0 commit comments