1515from dns .rrset import RRset
1616from pytest_container import BindMount
1717from pytest_container import DerivedContainer
18- from pytest_container import container_and_marks_from_pytest_param
1918from pytest_container .container import ContainerData
2019from pytest_container .container import EntrypointSelection
2120
@@ -117,32 +116,28 @@ def env_to_dict(env_stdout: str) -> Dict[str, str]:
117116 assert env_to_dict (env ) == env_to_dict (env_with_source )
118117
119118
120- _BIND_WITH_CUSTOM_CONF = []
121- for param in BIND_CONTAINERS :
122- ctr , marks = container_and_marks_from_pytest_param (param )
119+ _BIND_WITH_CUSTOM_CONF : List [DerivedContainer ] = []
120+ for ctr in BIND_CONTAINERS :
123121 _NAMED_CONF = "/etc/bind/named.conf"
124122 _BIND_WITH_CUSTOM_CONF .append (
125- pytest .param (
126- DerivedContainer (
127- base = ctr ,
128- extra_environment_variables = {"NAMED_CONF" : _NAMED_CONF },
129- volume_mounts = [
130- BindMount (
131- container_path = _NAMED_CONF ,
132- host_path = str (
133- Path (__file__ ).parent / "files" / "named.conf"
134- ),
123+ DerivedContainer (
124+ base = ctr ,
125+ extra_environment_variables = {"NAMED_CONF" : _NAMED_CONF },
126+ volume_mounts = [
127+ BindMount (
128+ container_path = _NAMED_CONF ,
129+ host_path = str (
130+ Path (__file__ ).parent / "files" / "named.conf"
135131 ),
136- BindMount (
137- container_path = "/etc/bind/db.blocked" ,
138- host_path = str (
139- Path ( __file__ ). parent / "files" / "db.blocked"
140- ),
132+ ),
133+ BindMount (
134+ container_path = "/etc/bind/db.blocked" ,
135+ host_path = str (
136+ Path ( __file__ ). parent / "files" / "db.blocked"
141137 ),
142- ],
143- forwarded_ports = ctr .forwarded_ports ,
144- ),
145- marks = marks ,
138+ ),
139+ ],
140+ forwarded_ports = ctr .forwarded_ports ,
146141 )
147142 )
148143
@@ -167,21 +162,16 @@ def test_custom_named_config(container: ContainerData) -> None:
167162 assert not empty_resp .answer
168163
169164
170- _BIND_WITH_CUSTOM_CHECKER = []
165+ _BIND_WITH_CUSTOM_CHECKER : List [ DerivedContainer ] = []
171166_CHECKER_TOUCHED_FILE = "/tmp/check-conf-worked"
172- for param in BIND_CONTAINERS :
173- ctr , marks = container_and_marks_from_pytest_param (param )
174-
167+ for ctr in BIND_CONTAINERS :
175168 _BIND_WITH_CUSTOM_CHECKER .append (
176- pytest .param (
177- DerivedContainer (
178- base = ctr ,
179- extra_environment_variables = {
180- "NAMED_CHECKCONF_BIN" : "/usr/bin/touch" ,
181- "NAMED_CHECKCONF_ARGS" : _CHECKER_TOUCHED_FILE ,
182- },
183- ),
184- marks = marks ,
169+ DerivedContainer (
170+ base = ctr ,
171+ extra_environment_variables = {
172+ "NAMED_CHECKCONF_BIN" : "/usr/bin/touch" ,
173+ "NAMED_CHECKCONF_ARGS" : _CHECKER_TOUCHED_FILE ,
174+ },
185175 )
186176 )
187177
@@ -198,20 +188,15 @@ def test_custom_checker(container: ContainerData) -> None:
198188 assert container .connection .file (_CHECKER_TOUCHED_FILE ).exists
199189
200190
201- _BIND_WITH_BASH = []
202- for param in BIND_CONTAINERS :
203- ctr , marks = container_and_marks_from_pytest_param (param )
204-
191+ _BIND_WITH_BASH : List [DerivedContainer ] = []
192+ for ctr in BIND_CONTAINERS :
205193 _BIND_WITH_BASH .append (
206- pytest .param (
207- DerivedContainer (
208- base = ctr ,
209- # don't launch bind as it chown's /var/lib/named
210- entry_point = EntrypointSelection .BASH ,
211- # ignore healthcheck, bind is not running in this container
212- healthcheck_timeout = timedelta (seconds = - 1 ),
213- ),
214- marks = marks ,
194+ DerivedContainer (
195+ base = ctr ,
196+ # don't launch bind as it chown's /var/lib/named
197+ entry_point = EntrypointSelection .BASH ,
198+ # ignore healthcheck, bind is not running in this container
199+ healthcheck_timeout = timedelta (seconds = - 1 ),
215200 )
216201 )
217202
0 commit comments