Skip to content

Commit

Permalink
Output test now uses regex
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Dec 16, 2019
1 parent ef26fc6 commit d94b54e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions aiida/backends/tests/cmdline/commands/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ def test_import_make_new_group(self):

def test_comment_mode(self):
"""Test toggling comment mode flag"""
import re
archives = [get_archive_file(self.newest_archive, filepath=self.archive_path)]

for mode in {'newest', 'overwrite'}:
for mode in ['newest', 'overwrite']:
options = ['--comment-mode', mode] + archives
result = self.cli_runner.invoke(cmd_import.cmd_import, options)
self.assertIsNone(result.exception, result.output)
self.assertIn('Comment mode: {}'.format(mode), result.output)
self.assertTrue(
any([re.fullmatch(r'Comment mode[\s]*{}'.format(mode), line) for line in result.output.split('\n')]),
msg='Mode: {}. Output: {}'.format(mode, result.output)
)
self.assertEqual(result.exit_code, 0, result.output)

def test_import_old_local_archives(self):
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements_for_rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ tornado<5.0
tqdm~=4.40
tzlocal~=2.0
upf_to_json~=0.9.2
wrapt~=1.11
wrapt~=1.11

0 comments on commit d94b54e

Please sign in to comment.