1
0
mirror of synced 2024-11-22 01:04:23 +01:00

Make the testsuite a bit more robust

Some terminals with a small number of column
could wrap the cli's output in a way that
would make the testsuite fail.
This commit break the tests in several smaller one
to mitigate this.

This issue was originally reported by eleius
[here](https://github.com/actionless/pikaur/issues/433), and forwarded as #153.
This commit is contained in:
jvoisin 2019-12-23 23:10:39 +01:00
parent b2efffdaa4
commit 0902e9e330

View File

@ -22,16 +22,22 @@ class TestHelp(unittest.TestCase):
def test_help(self): def test_help(self):
proc = subprocess.Popen(mat2_binary + ['--help'], stdout=subprocess.PIPE) proc = subprocess.Popen(mat2_binary + ['--help'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate() stdout, _ = proc.communicate()
self.assertIn(b'mat2 [-h] [-V] [--unknown-members policy] [--inplace] [--no-sandbox]', self.assertIn(b'mat2 [-h] [-V]', stdout)
stdout) self.assertIn(b'[--unknown-members policy]', stdout)
self.assertIn(b' [-v] [-l] [--check-dependencies] [-L | -s]', stdout) self.assertIn(b'[--inplace]', stdout)
self.assertIn(b'[--no-sandbox]', stdout)
self.assertIn(b' [-v] [-l]', stdout)
self.assertIn(b'[--check-dependencies]', stdout)
self.assertIn(b'[-L | -s]', stdout)
self.assertIn(b'[files [files ...]]', stdout) self.assertIn(b'[files [files ...]]', stdout)
def test_no_arg(self): def test_no_arg(self):
proc = subprocess.Popen(mat2_binary, stdout=subprocess.PIPE) proc = subprocess.Popen(mat2_binary, stdout=subprocess.PIPE)
stdout, _ = proc.communicate() stdout, _ = proc.communicate()
self.assertIn(b'mat2 [-h] [-V] [--unknown-members policy] [--inplace] [--no-sandbox]', self.assertIn(b'mat2 [-h] [-V]', stdout)
stdout) self.assertIn(b'[--unknown-members policy]', stdout)
self.assertIn(b'[--inplace]', stdout)
self.assertIn(b'[--no-sandbox]', stdout)
self.assertIn(b' [-v] [-l] [--check-dependencies] [-L | -s]', stdout) self.assertIn(b' [-v] [-l] [--check-dependencies] [-L | -s]', stdout)
self.assertIn(b'[files [files ...]]', stdout) self.assertIn(b'[files [files ...]]', stdout)