Skip to content

Commit

Permalink
tests/instances: Add tests for postprocessing instances
Browse files Browse the repository at this point in the history
  • Loading branch information
duylethanh committed Aug 31, 2022
1 parent aaacb86 commit a83a4b2
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 1 deletion.
62 changes: 62 additions & 0 deletions tests/instances/experiments_ymls/postprocess/experiments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This file contains postprocessed SNAP, local, multiple extension
# arbitrary file, URL and Git instances.
instances:
# SNAP Instances
- repo: snap
items:
- 'facebook_combined'
- 'cit-HepTh'
postprocess: to_edgelist
- repo: snap
items:
- 'ca-CondMat'
- 'cit-HepPh'
postprocess:
- args: ['echo', '1', '@INSTANCE@']
# Local Instances
- repo: local
items:
- 'instance1'
- 'instance2'
postprocess:
- args: ['echo', '1', '@INSTANCE@']
# Multiple Extensions
- repo: local
extensions:
- 'graph'
- 'xyz'
items:
- 'instance3'
- 'instance4'
postprocess:
- args: ['echo', '1', '@INSTANCE:graph@']
- args: ['echo', '2', '@INSTANCE:xyz@']
# Arbitrary Files
- repo: local
items:
- name: foo
files:
- 'instance5'
- 'instance6'
postprocess:
- args: ['echo', '1', '@INSTANCE:0@']
- args: ['echo', '2', '@INSTANCE:1@']
# URL Instances
- method: url
url: 'https://raw.githubusercontent.com/hu-macsy/simexpal/master/simexpal/schemes/@INSTANCE_FILENAME@'
items:
- 'experiments.json'
- 'launchers.json'
postprocess:
- args: ['echo', '1', '@INSTANCE@']
# Git Instances
- method: git
git: 'https://github.com/hu-macsy/simexpal'
repo_name: 'foo'
commit: 'master'
items:
- 'setup.py'
- 'pytest.ini'
postprocess:
- args: ['echo', '1', '@INSTANCE@']

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
11 changes: 10 additions & 1 deletion tests/instances/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

yml_dirs = ['/experiments_ymls/snap/',
'/experiments_ymls/url/',
'/experiments_ymls/git/']
'/experiments_ymls/git/',
'/experiments_ymls/postprocess/']

@pytest.mark.parametrize('rel_yml_path', yml_dirs)
def test_download(rel_yml_path):
Expand All @@ -17,3 +18,11 @@ def test_download(rel_yml_path):
instance.install()

assert instance.check_available()

if 'postprocess' in instance._inst_yml:
instance_dir = instance.config.instance_dir()

assert os.path.isfile(os.path.join(instance_dir, instance.yml_name) + '.postprocessed')

for file in instance.filenames:
assert os.path.isfile(os.path.join(instance_dir, file + '.original'))

0 comments on commit a83a4b2

Please sign in to comment.