@@ -39,7 +39,7 @@ def pytest_collect_file(parent, file_path):
3939 return RemoteRepoList .from_parent (parent , path = file_path )
4040
4141
42- def make_test_func (args , skip_build = False , extra_run_kwargs = None ):
42+ def make_test_func (args , skip_build = False , extra_run_kwargs = None , external_script = None ):
4343 """Generate a test function that runs repo2docker"""
4444
4545 def test ():
@@ -82,6 +82,10 @@ def build_noop():
8282 success = True
8383 break
8484 assert success , f"Notebook never started in { container } "
85+
86+ if external_script :
87+ subprocess .check_call ([external_script , f"http://localhost:{ port } " ])
88+
8589 finally :
8690 # stop the container
8791 container .stop ()
@@ -202,12 +206,21 @@ class Repo2DockerTest(pytest.Function):
202206 """A pytest.Item for running repo2docker"""
203207
204208 def __init__ (
205- self , name , parent , args = None , skip_build = False , extra_run_kwargs = None
209+ self ,
210+ name ,
211+ parent ,
212+ args = None ,
213+ skip_build = False ,
214+ extra_run_kwargs = None ,
215+ external_script = None ,
206216 ):
207217 self .args = args
208218 self .save_cwd = os .getcwd ()
209219 f = parent .obj = make_test_func (
210- args , skip_build = skip_build , extra_run_kwargs = extra_run_kwargs
220+ args ,
221+ skip_build = skip_build ,
222+ extra_run_kwargs = extra_run_kwargs ,
223+ external_script = external_script ,
211224 )
212225 super ().__init__ (name , parent , callobj = f )
213226
@@ -246,6 +259,17 @@ def collect(self):
246259 args .append (str (self .path .parent ))
247260 yield Repo2DockerTest .from_parent (self , name = "build" , args = args )
248261
262+ # If external-verify exists it should be run on the host
263+ external_verify_script = self .path .parent / "external-verify"
264+ if external_verify_script .exists ():
265+ yield Repo2DockerTest .from_parent (
266+ self ,
267+ name = external_verify_script .name ,
268+ args = args ,
269+ skip_build = True ,
270+ external_script = external_verify_script ,
271+ )
272+
249273 yield Repo2DockerTest .from_parent (
250274 self ,
251275 name = self .path .name ,
0 commit comments