Skip to content

Commit

Permalink
Update integration test for version output
Browse files Browse the repository at this point in the history
The test previously needed to check stdout and stderr;
now that we only support Python 3+, the version will
always go to stdout.

Additionally, add more check on the components of the
version string, now that it is defined separately from the
user agent string.
  • Loading branch information
kdaily committed May 7, 2024
1 parent 6827654 commit f26fca0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,17 @@ def test_table_output(self):
def test_version(self):
p = aws('--version')
self.assertEqual(p.rc, 0)
# The version is wrote to standard out for Python 3.4 and
# standard error for other Python versions.
version_output = p.stderr.startswith('aws-cli') or \
p.stdout.startswith('aws-cli')
self.assertTrue(version_output, p.stderr)
version_output = p.stdout

# There should be four components: aws-cli version, Python version,
# platform version, and installation source. The CLI and Python
# version have fixed format; the platform and install source can
# change based on the system they are invoked.
self.assertTrue(len(version_output.split(" ")) == 4, p.stderr)

self.assertTrue(version_output.startswith('aws-cli'), p.stderr)
self.assertTrue("Python/" in version_output, p.stderr)


def test_traceback_printed_when_debug_on(self):
p = aws('ec2 describe-instances --filters BADKEY=foo --debug')
Expand Down

0 comments on commit f26fca0

Please sign in to comment.