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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Because it has no `filter` field, this directive applies to all tests.
[[]]
# To run Python tests we recommend using some prepared container image.
# This directive is using a container image from hub.docker.com.
# We are choosing an image with Python 3.12.3.
= "docker://python:3.12.3-slim"
# By default, we will use the layers and environment variables, but you can uncomment this line to
# customize what gets used.
# image.use = [ "environment", "layers" ]
# Don't bother enabling the network. We can set to "loopback" to run on the
# cluster using only the loopback network, or to "local" to only run on the
# local machine but with full network access.
#
# This is the default value:
# network = "disabled"
# Don't bother creating a writable container for our test. It can still write to /tmp .
#
# This is the default value:
# enable_writable_file_system = false
# Have our tests run with root as a working directory.
#
# This is the default value:
# working_directory = "/"
# Run our test as root.
#
# These are the default values:
# user = 0
# group = 0
# Use `added_layers` here since we want to add to what are provided by the image.
= [
# This layer includes all the Python files from our project.
{ = "**.{py,pyc,pyi}" },
# Include pyproject.toml if it exists.
{ = "pyproject.toml" },
# This layer just includes files and directories for mounting the following
# file-systems and devices.
{ = [ "/{proc,sys,tmp}/", "/dev/{full,null,random,urandom,zero}" ] },
]
# Provide /tmp, /proc, /sys, and some devices in /dev/. These are used pretty
# commonly by tests.
= [
{ = "tmp", = "/tmp" },
{ = "proc", = "/proc" },
{ = "sys", = "/sys" },
{ = "devices", = ["full", "null", "random", "urandom", "zero"] },
]
# Later directives can override the `environment` key, but the `added_environment` key is only
# additive. By using it here we ensure it applies to all tests regardless of other directives.
[]
# If we are using the xdist plugin, we need to tell it we don't want any parallelism since we are
# only running one test per process.
= "1"
# This directive illustrates how to apply a change to one specific test
# "tests.py::Tests::my_special_test".
# Here we change the user and group to be used for this test to 1000.
# Everything else we inherit from the first directive in this file.
#
# [[directives]]
# filter = "node_id.equals(tests.py::Tests::my_special_test)"
# user = 1000
# group = 1000
# Some useful filters to use in directives.
#
# # Select all tests with the name "my_test".
# filter = "name.equals(my_test)"
#
# # Select all tests with either the "foo" or "bar" marker.
# filter = "markers.contains(foo) || markers.contains(bar)"
#
# # Select tests that have a node_id starting with "foo.py"
# filter = "node_id.starts_with(foo.py)"
# # Select tests that have a node_id ending with "::CommonTests::test_it"
# filter = "node_id.ends_with(::CommonTests::test_it)"