Skip to content

Commit 279d05f

Browse files
committed
Fix: small edits from review
1 parent 0455fa7 commit 279d05f

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

images/python-package-test-tools.png

93.8 KB
Loading

images/test-tools.png

-49.6 KB
Binary file not shown.

tests/run-tests.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ is working as expected. However, it's also important to think about your code ru
99
On this page, you will learn about the tools that you can use to both run tests in isolated environments and across
1010
Python versions.
1111

12+
13+
1214
### Tools to run your tests
1315

1416
There are three types of tools that will make is easier to setup and run your tests in various environments:
@@ -18,7 +20,7 @@ There are three types of tools that will make is easier to setup and run your te
1820
3. **Continuous Integration (CI):** is the last tool that you'll need to run your tests. CI will not only allow you to replicate any automated builds you create using nox or tox to run your package in different Python environments. It will also allow you to run your tests on different operating systems (Windows, Mac and Linux). [We discuss using CI to run tests here](tests-ci).
1921

2022
:::{figure-md}
21-
![Figure showing three boxes - the first has Test Frameworks in it, the second Test Runner and the third Continuous Integration....](../images/test-tools.png)
23+
![Figure showing three boxes - the first has Test Frameworks in it, the second Test Runner and the third Continuous Integration....](../images/python-package-test-tools.png)
2224

2325
There are three types of tools that will help you develop and run your tests. Test frameworks like pytest
2426
provide syntax and a **framework** for you to write and
@@ -97,9 +99,14 @@ with it. Make also won't manage environments for you like **nox** will do.
9799
set up virtual environments, and run tests across Python versions using the environment manager of your choice with a
98100
single command.
99101

102+
:::{note} Nox Installations
103+
104+
When you use nox to run tests across different Python versions, nox will create and manage individual `venv` environments for each Python version that you specify in the nox function. It will setup everything that you need to run tests in each environment for you.
105+
:::
106+
100107
Nox can also be used for other development tasks such as building
101-
documentation, creating your package distribution, and testing across various
102-
environment managers such as `conda` and `pip`.
108+
documentation, creating your package distribution, and testing installations
109+
across both PyPI related environments (e.g. venv, virtualenv) and `conda` (e.g. `conda-forge`).
103110

104111
## Test Environments
105112

@@ -113,17 +120,24 @@ Note that for the code below to work, you need to have all 4 versions of Python
113120

114121
### Nox with venv environments
115122

116-
```{admonition} TODO:
123+
```{todo}
117124
TODO: add some tests above and show what the output would look like in the examples below...
118125
```
119126

120127
Below is an example of setting up nox to run tests using `venv` which is the built in environment manager that comes with base Python.
121128

122129
Note that the example below assumes that you have [setup your `pyproject.toml` to declare test dependencies in a way that pip
123-
can understand](../package-structure-code/declare-dependencies.md). An example of that setup is below.
130+
can understand](../package-structure-code/declare-dependencies.md). An example
131+
of that setup is below.
124132

125133
```toml
134+
[build-system]
135+
requires = ["hatchling"]
136+
build-backend = "hatchling.build"
137+
126138
[project]
139+
name = "pyosPackage"
140+
version = "0.1.0"
127141
dependencies = [
128142
"geopandas",
129143
"xarray",
@@ -157,9 +171,9 @@ Above you create a nox session in the form of a function
157171
with a `@nox.session` decorator. Notice that within the decorator you declare the versions of python that you
158172
wish to run.
159173

160-
To run the above you'd use the command where `-s` stands for
161-
session. Your function above is called test, therefore
162-
the session name is test.
174+
To run the above you'd use the command where `--session`. You may also see
175+
people useing the shortcut for session `-s`. Your function above
176+
is called test, therefor the session name is test.
163177

164178
```
165179
nox -s test

0 commit comments

Comments
 (0)