def default_out_dir():
    detector = SCMDetector(FileSystem(), Executive())
    current_scm = detector.detect_scm_system(os.path.dirname(sys.argv[0]))
    if not current_scm:
        return os.getcwd()
    root_dir = current_scm.checkout_root
    if not root_dir:
        return os.getcwd()
    out_dir = os.path.join(root_dir, "LayoutTests/fast/canvas/webgl")
    if os.path.isdir(out_dir):
        return out_dir
    return os.getcwd()
Ejemplo n.º 2
0
    def test_detect_scm_system(self):
        filesystem = MockFileSystem()
        executive = MockExecutive(should_log=True)
        detector = SCMDetector(filesystem, executive)

        with OutputCapture(level=logging.INFO) as captured:
            scm = detector.detect_scm_system('/')
        self.assertEqual(
            captured.root.log.getvalue(),
            '''MOCK run_command: ['svn', 'info'], cwd=/
MOCK run_command: ['git', 'rev-parse', '--is-inside-work-tree'], cwd=/
''',
        )

        self.assertIsNone(scm)