1
0
Fork 0
forked from github/pelican

Fix false-positive in content gen. test failures

Assert equal dirs by return value of diff subprocess, rather than its output.

This prevents tests from failing when file contents are the same but the
file modes are different.

Fix #3042
This commit is contained in:
Ryan de Kleer 2022-09-15 16:51:34 -07:00
commit b10c7c699b
2 changed files with 42 additions and 26 deletions

View file

@ -218,6 +218,23 @@ class LogCountHandler(BufferingHandler):
])
def diff_subproc(first, second):
"""
Return a subprocess that runs a diff on the two paths.
Check results with::
>>> out_stream, err_stream = proc.communicate()
>>> didCheckFail = proc.returnCode != 0
"""
return subprocess.Popen(
['git', '--no-pager', 'diff', '--no-ext-diff', '--exit-code',
'-w', first, second],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
class LoggedTestCase(unittest.TestCase):
"""A test case that captures log messages."""