def test_script_vars(self): with tempscript("""#!/bin/bash # this is an example shell script export VAR1=simplevalue export VAR2="This is an example of a multiline=variable with an embedded equal sign" export VAR3=123 """) as f: vars = shellvars.list_vars(f.name) self.assertEqual(set(vars), set(('VAR1', 'VAR2', 'VAR3')))
def test_script_vars_ignores(self): with tempscript("export VAR1=1") as f: vars = shellvars.list_vars(f.name, ignore=['VAR1']) self.assertFalse('VAR1' in vars)