tests: Ignore warnings when running validation script

The script is run as a standalone process. Anything printed to stderr
breaks the test.

Since Python 3.8, we are getting warnings about invalid escape sequences
in some modules that are imported but not owned by us.

This patch should silence the warnings.

Relates: https://bugzilla.redhat.com/show_bug.cgi?id=1698514
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-05-15 15:49:20 +02:00
parent d0e8472ab5
commit a33cb0bf91

View File

@ -22,9 +22,11 @@ class ConfigValidateScriptTest(helpers.PungiTestCase):
def test_validate_dummy_config(self): def test_validate_dummy_config(self):
DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf') DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf')
interp = 'python2' if six.PY2 else 'python3' interp = 'python2' if six.PY2 else 'python3'
p = subprocess.Popen([interp, PUNGI_CONFIG_VALIDATE, DUMMY_CONFIG], p = subprocess.Popen(
[interp, "-W", "ignore", PUNGI_CONFIG_VALIDATE, DUMMY_CONFIG],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE,
)
(stdout, stderr) = p.communicate() (stdout, stderr) = p.communicate()
self.assertEqual(b'', stdout) self.assertEqual(b'', stdout)
self.assertEqual(b'', stderr) self.assertEqual(b'', stderr)