@@ -483,65 +483,72 @@ def _image_directories(func):
483483 doesn't exist.
484484 """
485485 module_path = Path (sys .modules [func .__module__ ].__file__ )
486- if func .__module__ .startswith ("matplotlib." ):
487- try :
488- import matplotlib_baseline_images
489- except :
490- generate_matplotlib_baseline_images_from_previous_commit ()
491- baseline_dir = (Path (matplotlib_baseline_images .__file__ ).parent /
492- module_path .stem )
493- elif func .__module__ .startswith ("mpl_toolkits." ):
494- try :
495- import mpl_toolkits_baseline_images
496- except :
497- generate_matplotlib_baseline_images_from_previous_commit ()
498- baseline_dir = (Path (mpl_toolkits_baseline_images .__file__ ).parent /
499- module_path .stem )
500- else :
501- baseline_dir = (module_path .parent /
502- "baseline_images" /
503- module_path .stem )
486+ '''
487+ # if func.__module__.startswith("matplotlib."):
488+ #
489+ # try:
490+ # import matplotlib_baseline_images
491+ # except:
492+ # generate_matplotlib_baseline_images_from_previous_commit()
493+ # baseline_dir = (Path(matplotlib_baseline_images.__file__).parent /
494+ # module_path.stem)
495+ # elif func.__module__.startswith("mpl_toolkits."):
496+
497+ # try:
498+ # import mpl_toolkits_baseline_images
499+ # except:
500+ # generate_matplotlib_baseline_images_from_previous_commit()
501+
502+ # baseline_dir = (Path(mpl_toolkits_baseline_images.__file__).parent /
503+ # module_path.stem)
504+ # else:
505+ '''
506+ baseline_dir = (module_path .parent /
507+ "baseline_images" /
508+ module_path .stem )
504509 result_dir = Path ().resolve () / "result_images" / module_path .stem
505510 result_dir .mkdir (parents = True , exist_ok = True )
506511 return baseline_dir , result_dir
507512
508513
509- def generate_matplotlib_baseline_images_from_previous_commit ():
510- mplRepoPath = Path (mpl .__file__ ).parent
511- # Check that git is installed.
512- run_text_mode (shutil .which ('git' )) == None
513- # Check if current repository is a git repository
514- run_text_mode (['git' , 'status' ],
515- cwd = mplRepoPath ) == None
516- # Create virtual env in tmpdir.
517- if not (mplRepoPath / 'testenv' ).exists ():
518- modify_existing_baseline_images ()
519- else
520- # Clone mpl repo to tmpvenv and run pytests from new mpl repo created
521- run_text_mode (["git" , "worktree" , "add" , "testenv" ],
522- cwd = mplRepoPath )
523- testenvPath = mplRepoPath / testenv
524- run_text_mode ([sys .executable , "-mvenv" , "venv" ],
525- cwd = testenvPath )
526- run_text_mode (["source" , "venv/bin/activate" ],
527- cwd = testenvPath )
528- run_text_mode (["git" , "checkout" , "HEAD~" ],
529- cwd = testenvPath )
530- run_text_mode (["python" , "-mpip" , "install" , "-e" , mplRepoPath ],
531- cwd = testenvPath )
532- run_text_mode (["python" , "-mpytest" ],
533- cwd = testenvPath )
534- # Copy result_images in the temporary directory and cache it
535- run_text_mode (shutil .copytree (testenvPath / "result_images" ,
536- mplRepoPath / ".pytest_cache" ),
537- cwd = mplRepoPath )
538-
539- def modify_existing_baseline_images ():
540- # TODO
541- return
542-
543- def run_text_mode (* args , ** kwargs ):
544- return subprocess .run (* args , ** kwargs ,
545- stderr = subprocess .STDOUT ,
546- stdout = open (os .devnull , 'w' ),
547- universal_newlines = True )
514+ '''
515+ #def generate_matplotlib_baseline_images_from_previous_commit():
516+ # mplRepoPath = Path(mpl.__file__).parent
517+ # # Check that git is installed.
518+ # run_text_mode(shutil.which('git')) == None
519+ # # Check if current repository is a git repository
520+ # run_text_mode(['git', 'status'],
521+ # cwd = mplRepoPath) == None
522+ # # Create virtual env in tmpdir.
523+ # if not (mplRepoPath / 'testenv').exists():
524+ # modify_existing_baseline_images()
525+ # else
526+ # # Clone mpl repo to tmpvenv and run pytests from new mpl repo created
527+ # run_text_mode(["git", "worktree", "add", "testenv"],
528+ # cwd = mplRepoPath)
529+ # testenvPath = mplRepoPath / testenv
530+ # run_text_mode([sys.executable, "-mvenv", "venv"],
531+ # cwd = testenvPath)
532+ # run_text_mode(["source", "venv/bin/activate"],
533+ # cwd = testenvPath)
534+ # run_text_mode(["git", "checkout", "HEAD~"],
535+ # cwd = testenvPath)
536+ # run_text_mode(["python", "-mpip", "install", "-e", mplRepoPath],
537+ # cwd = testenvPath)
538+ # run_text_mode(["python", "-mpytest"],
539+ # cwd = testenvPath)
540+ # # Copy result_images in the temporary directory and cache it
541+ # run_text_mode(shutil.copytree(testenvPath / "result_images",
542+ # mplRepoPath / ".pytest_cache"),
543+ # cwd = mplRepoPath)
544+
545+ # def modify_existing_baseline_images():
546+ ## # TODO
547+ # return
548+
549+ #def run_text_mode(*args, **kwargs):
550+ # return subprocess.run(*args, **kwargs,
551+ # stderr=subprocess.STDOUT,
552+ # stdout = open(os.devnull, 'w'),
553+ # universal_newlines=True)
554+ '''
0 commit comments