Skip to content

Commit

Permalink
[tests] Do not print data running 'run_tests.py'
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sduenas committed Dec 3, 2024
1 parent f16b29d commit f437d2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,15 +2072,21 @@ 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")

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())

Expand Down
1 change: 0 additions & 1 deletion tests/test_gitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit f437d2b

Please sign in to comment.