@@ -557,6 +557,8 @@ def save_figure(self, item, fig, filename):
557
557
savefig_kwargs = compare .kwargs .get ('savefig_kwargs' , {})
558
558
deterministic = compare .kwargs .get ('deterministic' , False )
559
559
560
+ original_source_date_epoch = os .environ .get ('SOURCE_DATE_EPOCH' , None )
561
+
560
562
if deterministic :
561
563
562
564
# Make sure we don't modify the original dictionary in case is a common
@@ -568,18 +570,28 @@ def save_figure(self, item, fig, filename):
568
570
569
571
ext = self ._file_extension (item )
570
572
573
+ extra_rcparams = {}
574
+
571
575
if ext == 'png' :
572
576
extra_metadata = {"Software" : None }
573
577
elif ext == 'pdf' :
574
578
extra_metadata = {"Creator" : None , "Producer" : None , "CreationDate" : None }
575
579
elif ext == 'eps' :
576
580
extra_metadata = {"Creator" : "test" }
581
+ os .environ ['SOURCE_DATE_EPOCH' ] = '1234567890'
577
582
elif ext == 'svg' :
578
583
extra_metadata = {"Date" : None }
584
+ extra_rcparams ["svg.hashsalt" ] = "test"
579
585
580
586
savefig_kwargs ['metadata' ].update (extra_metadata )
581
587
582
- fig .savefig (filename , ** savefig_kwargs )
588
+ import matplotlib .pyplot as plt
589
+
590
+ with plt .rc_context (** extra_rcparams ):
591
+ fig .savefig (filename , ** savefig_kwargs )
592
+
593
+ if original_source_date_epoch is not None :
594
+ os .environ ['SOURCE_DATE_EPOCH' ] = original_source_date_epoch
583
595
584
596
def compare_image_to_hash_library (self , item , fig , result_dir , summary = None ):
585
597
hash_comparison_pass = False
0 commit comments