From e5c3768c080551b6cd05916f1a0d9445a2a7eb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Due=C3=B1as?= Date: Tue, 3 Dec 2024 14:58:09 +0100 Subject: [PATCH] [tests] Do not print data running 'run_tests.py' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some tests procuced some noise when the are run with 'run_tests.py' script. Data is send to '/dev/null' or similar. Signed-off-by: Santiago DueƱas --- tests/test_git.py | 10 ++++++++-- tests/test_gitter.py | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_git.py b/tests/test_git.py index 1f2324661..d5f92930d 100644 --- a/tests/test_git.py +++ b/tests/test_git.py @@ -2072,6 +2072,8 @@ def test_has_loose_objects(self): # Create a loose object in the repository process = subprocess.Popen(['git', 'hash-object', '-w', '--stdin'], stdin=subprocess.PIPE, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, cwd=new_path, env={'LANG': 'C'}) process.communicate(input=b"Data test") @@ -2079,8 +2081,12 @@ def test_has_loose_objects(self): self.assertTrue(repo.has_loose_objects()) # Group loose objects in a packfile and remove unreachable objects - subprocess.run(['git', 'gc'], cwd=new_path, check=True) - subprocess.run(['git', 'prune'], cwd=new_path, check=True) + subprocess.run(['git', 'gc'], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + cwd=new_path, check=True) + subprocess.run(['git', 'prune'], + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + cwd=new_path, check=True) self.assertFalse(repo.has_loose_objects()) diff --git a/tests/test_gitter.py b/tests/test_gitter.py index 6809616d0..c59e05d51 100644 --- a/tests/test_gitter.py +++ b/tests/test_gitter.py @@ -204,7 +204,6 @@ def test_fetch_from_date(self): from_date = datetime.datetime(2020, 3, 24, 0, 0, tzinfo=dateutil.tz.tzutc()) backend = Gitter(group='testapicomm', room='community', api_token='aaa', max_items=1) messages = [m for m in backend.fetch(from_date=from_date)] - print(messages) self.assertEqual(len(messages), 1) message = messages[0]