|
|
@ -563,6 +563,24 @@ class CommandLineTestCase(unittest.TestCase):
|
|
|
|
self.assertEqual(
|
|
|
|
self.assertEqual(
|
|
|
|
(ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
|
|
|
|
(ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_github_actions_detection(self):
|
|
|
|
|
|
|
|
path = os.path.join(self.wd, 'a.yaml')
|
|
|
|
|
|
|
|
self.addCleanup(os.environ.__delitem__, 'GITHUB_ACTIONS')
|
|
|
|
|
|
|
|
self.addCleanup(os.environ.__delitem__, 'GITHUB_WORKFLOW')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with RunContext(self) as ctx:
|
|
|
|
|
|
|
|
os.environ['GITHUB_ACTIONS'] = 'something'
|
|
|
|
|
|
|
|
os.environ['GITHUB_WORKFLOW'] = 'something'
|
|
|
|
|
|
|
|
cli.run((path, ))
|
|
|
|
|
|
|
|
expected_out = (
|
|
|
|
|
|
|
|
'::error file=%s,line=2,col=4::[trailing-spaces] trailing'
|
|
|
|
|
|
|
|
' spaces\n'
|
|
|
|
|
|
|
|
'::error file=%s,line=3,col=4::[new-line-at-end-of-file] no'
|
|
|
|
|
|
|
|
' new line character at the end of file\n'
|
|
|
|
|
|
|
|
% (path, path))
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
|
|
|
(ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
|
|
|
|
|
|
|
|
|
|
|
|
def test_run_read_from_stdin(self):
|
|
|
|
def test_run_read_from_stdin(self):
|
|
|
|
# prepares stdin with an invalid yaml string so that we can check
|
|
|
|
# prepares stdin with an invalid yaml string so that we can check
|
|
|
|
# for its specific error, and be assured that stdin was read
|
|
|
|
# for its specific error, and be assured that stdin was read
|
|
|
|