@@ -239,6 +239,21 @@ def test_whole_workflow(tmpdir):
239239 "--check" ,
240240 ]
241241 )
242+ # Now edit one of the generated files to make the check fail
243+ with open ("workflow_bootstrap.py" , "a" ) as fd :
244+ fd .write ("# EXTRA CONTENT\n \n " )
245+
246+ with pytest .raises (subprocess .CalledProcessError ):
247+ subprocess .check_call (
248+ [
249+ str (binary ),
250+ "-m" ,
251+ "bench_runner" ,
252+ "install" ,
253+ "--check" ,
254+ ]
255+ )
256+
242257 with open ("requirements.txt" , "w" ) as fd :
243258 fd .write (f"{ str (bench_runner_checkout )} \n " )
244259 subprocess .check_call (
@@ -253,3 +268,62 @@ def test_whole_workflow(tmpdir):
253268 "--_fast" ,
254269 ]
255270 )
271+
272+
273+ @pytest .mark .long_running
274+ @pytest .mark .skipif (not sys .platform .startswith ("linux" ), reason = "Linux only" )
275+ def test_pystats (tmpdir ):
276+ """
277+ Tests the whole workflow from a clean benchmarking repo.
278+ """
279+ tmpdir = Path (tmpdir )
280+ repo = tmpdir / "repo"
281+ venv_dir = repo / "outer_venv"
282+ bench_runner_checkout = DATA_PATH .parents [1 ]
283+ if sys .platform .startswith ("win" ):
284+ binary = venv_dir / "Scripts" / "python.exe"
285+ else :
286+ binary = venv_dir / "bin" / "python"
287+ profiling_dir = Path (repo / "profiling" / "results" )
288+
289+ repo .mkdir ()
290+ profiling_dir .mkdir (parents = True )
291+
292+ shutil .copyfile (DATA_PATH / "loops.json" , repo / "loops.json" )
293+
294+ with contextlib .chdir (repo ):
295+ subprocess .check_call ([sys .executable , "-m" , "venv" , str (venv_dir )])
296+ subprocess .check_call (
297+ [
298+ str (binary ),
299+ "-m" ,
300+ "pip" ,
301+ "install" ,
302+ "--upgrade" ,
303+ "pip" ,
304+ ]
305+ )
306+ subprocess .check_call (
307+ [str (binary ), "-m" , "pip" , "install" , f"{ bench_runner_checkout } [test]" ]
308+ )
309+ subprocess .check_call ([str (binary ), "-m" , "bench_runner" , "install" ])
310+ with open ("requirements.txt" , "w" ) as fd :
311+ fd .write (f"{ str (bench_runner_checkout )} \n " )
312+ subprocess .check_call (
313+ [
314+ str (binary ),
315+ "workflow_bootstrap.py" ,
316+ "python" ,
317+ "main" ,
318+ "linux-x86_64-linux" ,
319+ "deltablue" ,
320+ ",,," ,
321+ "--_fast" ,
322+ "--pystats" ,
323+ ]
324+ )
325+
326+ deltablue_output = list ((repo / "results" ).glob ("**/*-pystats-deltablue.*" ))
327+ assert len (deltablue_output ) == 2
328+ all_output = list ((repo / "results" ).glob ("**/*-pystats.*" ))
329+ assert len (all_output ) == 2
0 commit comments