Skip to content

Commit

Permalink
Use tarfile data filter if available
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Dec 15, 2024
1 parent 16b5177 commit 5cd242a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions support/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def test_analysis_on_precomputed(self):
# Get and extract precomputed results
with urllib.request.urlopen(RESULTS) as fh:
with tarfile.open(fileobj=fh, mode='r:gz') as tf:
tf.extractall()
if hasattr(tarfile, 'data_filter'):
tf.extractall(filter='data')
else:
tf.extractall()
for subdir in os.listdir('results/output'):
shutil.move('results/output/%s' % subdir, '../modeling/output/')

Expand All @@ -62,7 +65,10 @@ def test_accuracy_of_precomputed_analysis(self):
# Get and extract precomputed analysis
with urllib.request.urlopen(ANALYSIS) as fh:
with tarfile.open(fileobj=fh, mode='r:gz') as tf:
tf.extractall()
if hasattr(tarfile, 'data_filter'):
tf.extractall(filter='data')
else:
tf.extractall()

subprocess.check_call(["python", 'accuracy.py'])

Expand Down

0 comments on commit 5cd242a

Please sign in to comment.