Make tests work with LSAN logging

Summary:
D13366696 made some tests fail. These tests assume stderr doesn't print extra messages.

Make these tests tolerate extra messages on stderr, so extra logging doesn't make them fail.

Reviewed By: simpkins

Differential Revision: D13409510

fbshipit-source-id: 7c80766dd3978bb78c9a6fc8ed23310c2ee744e3
This commit is contained in:
Matt Glazar 2018-12-10 19:04:24 -08:00 committed by Facebook Github Bot
parent c91b552ef5
commit f0003e3735
2 changed files with 7 additions and 7 deletions

View File

@ -266,8 +266,8 @@ class CloneTest(testcase.EdenRepoTest):
with self.assertRaises(subprocess.CalledProcessError) as context:
self.eden.run_cmd("clone", repo_name, file_in_directory)
stderr = context.exception.stderr.decode("utf-8")
self.assertEqual(
stderr, f"error: destination path {file_in_directory} is not a directory\n"
self.assertIn(
f"error: destination path {file_in_directory} is not a directory\n", stderr
)
def test_clone_to_non_existent_directory_that_is_under_a_file_fails(self) -> None:
@ -279,8 +279,8 @@ class CloneTest(testcase.EdenRepoTest):
with self.assertRaises(subprocess.CalledProcessError) as context:
self.eden.run_cmd("clone", repo_name, non_existent_dir)
stderr = context.exception.stderr.decode("utf-8")
self.assertEqual(
stderr, f"error: destination path {non_existent_dir} is not a directory\n"
self.assertIn(
f"error: destination path {non_existent_dir} is not a directory\n", stderr
)
def test_post_clone_hook(self) -> None:
@ -339,10 +339,10 @@ echo -n "$1" >> "{scratch_file}"
with self.assertRaises(edenclient.EdenCommandError) as context:
self.eden.run_cmd("clone", repo_name, tmp)
self.assertEqual(
context.exception.stderr.decode(),
self.assertIn(
f"error: {repo_name!r} does not look like a valid hg or git "
"repository or a well-known repository name\n",
context.exception.stderr.decode(),
)
def test_clone_should_start_daemon(self) -> None:

View File

@ -139,7 +139,7 @@ class RemountTest(testcase.EdenRepoTest):
self.eden.clone(self.repo_name, mount_destination)
with self.assertRaises(edenclient.EdenCommandError) as context:
self.eden.run_cmd("mount", mount_destination)
self.assertEqual(
self.assertIn(
(
b"ERROR: Mount point in use! %s is already mounted by Eden.\n"
% mount_destination.encode()