sapling/eden/integration/hg/non_eden_operation_test.py
Adam Simpkins ef04ccf546 replace a bunch of pyre-fixme comments with pyre-ignoree
Summary:
D17135557 added a bunch of `pyre-fixme` comments to the EdenFS integration
tests for cases where Pyre cannot detect that some attributes are initialized
by the test case `setUp()` method.

It looks like Pyre's handling of `setUp()` is somewhat incorrect: it looks
like if a class has a `setUp()` method this currently suppresses all
uninitialized attribute errors (even if some attributes really are never
initialized).  However, Pyre does not detect `setUp()` methods inherited from
parent classes, and always warns about uninitialized attributes in this case
even they are initialized.

Lets change these comments from `pyre-fixme` to `pyre-ignore` since this
appears to be an issue with Pyre rather than with this code.  T62487924 is
open to track adding support for annotating custom constructor methods, which
might help here.  I've also posted in Pyre Q&A about incorrect handling of
`setUp()` in derived classes.

Reviewed By: grievejia

Differential Revision: D19963118

fbshipit-source-id: 9fd13fc8665367e0780f871a5a0d9a8fe50cc687
2020-02-24 18:55:19 -08:00

49 lines
1.8 KiB
Python

#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
import os
from eden.integration.hg.lib.hg_extension_test_base import EdenHgTestCase, hg_test
from eden.integration.lib import hgrepo
@hg_test
# pyre-ignore[13]: T62487924
class NonEdenOperationTest(EdenHgTestCase):
def populate_backing_repo(self, repo: hgrepo.HgRepository) -> None:
repo.write_file("hello.txt", "hola")
def test_hg_clone_non_eden_repo_within_eden_repo(self):
"""Regression test to ensure that running `hg` commands from an
Eden-backed Hg repo on a non-Eden-backed Hg repo work as expected."""
non_eden_hg_repo = os.path.join(self.tmp_dir, "non-eden-hg-repo")
os.mkdir(non_eden_hg_repo)
# Create the non-Eden Hg repo.
self.hg("init", cwd=non_eden_hg_repo)
first_file = os.path.join(non_eden_hg_repo, "first.txt")
with open(first_file, "w") as f:
f.write("First file in non-Eden-backed Hg repo.\n")
self.hg(
"commit",
"--config",
"ui.username=Kevin Flynn <lightcyclist@example.com>",
"-Am",
"first commit",
cwd=non_eden_hg_repo,
)
# Run `hg clone` from the Eden repo.
clone_of_non_eden_hg_repo = os.path.join(self.tmp_dir, "clone-target")
self.hg(
"clone", non_eden_hg_repo, clone_of_non_eden_hg_repo, cwd=self.repo.path
)
dest_first_file = os.path.join(clone_of_non_eden_hg_repo, "first.txt")
with open(dest_first_file, "r") as f:
contents = f.read()
self.assertEqual("First file in non-Eden-backed Hg repo.\n", contents)