import WatchmanInstance
import os
import tempfile
try:
    import unittest2 as unittest
except ImportError:
    import unittest

TestParent = object
try:
    from eden.integration.lib import (edenclient, hgrepo)

    def is_sandcastle():
        return 'SANDCASTLE' in os.environ

    if not is_sandcastle() and edenclient.can_run_eden():
        TestParent = WatchmanTestCase.WatchmanTestCase

    can_run_eden = edenclient.can_run_eden

except ImportError:
    def can_run_eden():
        return False


class WatchmanEdenTestCase(TestParent):
    def setUp(self):
        # the eden home directory.  We use the global dir for the test runner
        # rather than one scoped to the test because we have very real length
        # limits on the socket path name that we're likely to hit otherwise.
        # fake a home dir so that eden is isolated from the settings
Beispiel #2
0
import os
import tempfile

TestParent = object
try:
    import configparser  # python3
    from eden.integration.lib import (edenclient, hgrepo)
    from eden.integration.hg.lib.hg_extension_test_base import (
        EDEN_EXT_DIR,
        POST_CLONE,
    )

    def is_sandcastle():
        return 'SANDCASTLE' in os.environ

    if not is_sandcastle() and edenclient.can_run_eden():
        TestParent = WatchmanTestCase.WatchmanTestCase

    can_run_eden = edenclient.can_run_eden

except ImportError:
    def can_run_eden():
        return False


class WatchmanEdenTestCase(TestParent):
    def setUp(self):
        # the eden home directory.  We use the global dir for the test runner
        # rather than one scoped to the test because we have very real length
        # limits on the socket path name that we're likely to hit otherwise.
        # fake a home dir so that eden is isolated from the settings
import os
import tempfile

import WatchmanInstance
import WatchmanTestCase


TestParent = object
try:
    import configparser  # python3
    from eden.integration.lib import edenclient, hgrepo, find_executables

    def is_sandcastle():
        return "SANDCASTLE" in os.environ

    if edenclient.can_run_eden():
        TestParent = WatchmanTestCase.WatchmanTestCase

    can_run_eden = edenclient.can_run_eden

except ImportError as e:

    def is_buck_build():
        return "BUCK_BUILD_ID" in os.environ

    # We want import failures to hard fail the build when using buck internally
    # because it means we overlooked something, but we want it to be a soft
    # fail when we run our opensource build
    if is_buck_build():
        raise
Beispiel #4
0
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.

import os
import stat
import unittest
from pathlib import Path
from typing import Callable

from eden.integration.lib import edenclient, skip

from . import snapshot as snapshot_mod, verify as verify_mod


@unittest.skipIf(not edenclient.can_run_eden(), "unable to run edenfs")
class Test(unittest.TestCase):
    """Tests to verify the contents of various saved snapshots.

    All of the test functions in this class are dynamically added by register_tests()
    """
    def setUp(self) -> None:
        skip.skip_if_disabled(self)
        super().setUp()

    def _test_snapshot(self, snapshot_path: Path) -> None:
        with snapshot_mod.create_tmp_dir() as tmp_dir:
            snapshot = snapshot_mod.unpack_into(snapshot_path, tmp_dir)
            self._run_test(snapshot)

    def _run_test(self, snapshot: snapshot_mod.BaseSnapshot) -> None:
import os
import tempfile

import WatchmanInstance
import WatchmanTestCase


TestParent = object
try:
    import configparser  # python3
    from eden.integration.lib import edenclient, hgrepo

    def is_sandcastle():
        return "SANDCASTLE" in os.environ

    if edenclient.can_run_eden():
        TestParent = WatchmanTestCase.WatchmanTestCase

    can_run_eden = edenclient.can_run_eden

except ImportError as e:

    def is_buck_build():
        return "BUCK_BUILD_ID" in os.environ

    # We want import failures to hard fail the build when using buck internally
    # because it means we overlooked something, but we want it to be a soft
    # fail when we run our opensource build
    if is_buck_build():
        raise