Skip to content

Commit

Permalink
Test error handling when envvar is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperCraeghs committed Nov 6, 2023
1 parent b70368c commit 40efe43
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ def test_code_quality(self, path_cwd_mock):
self.assertEqual(2, retval)
self.assertTrue(filecmp.cmp(out_file, ref_file), '{} differs from {}'.format(out_file, ref_file))

def test_cq_description_format_missing_envvar(self):
os.environ['FIRST_ENVVAR'] = 'envvar_value'
filename = 'code_quality_format.json'
out_file = str(TEST_OUT_DIR / filename)
with self.assertRaises(ValueError) as c_m:
warnings_wrapper([
'--code-quality', out_file,
'--config', 'tests/test_in/config_code_quality_format.json',
'tests/test_in/mixed_warnings.txt',
])
self.assertEqual(
str(c_m.exception),
"Failed to find environment value while assembling code quality description: 'SECOND_ENVVAR'")

@patch('pathlib.Path.cwd')
def test_cq_description_format(self, path_cwd_mock):
os.environ['FIRST_ENVVAR'] = 'envvar_value'
Expand Down

0 comments on commit 40efe43

Please sign in to comment.