예제 #1
0
    def test_glob_single_sibling_file(self):
        with self.runner.isolated_filesystem():
            with open("test.bench.py", "w") as f:
                f.write("")

            resolved = resolve_pattern("*")

        self.assertEqual(resolved, ["test.bench.py"])
예제 #2
0
    def test_glob_single_nested_file(self):
        with self.runner.isolated_filesystem():
            os.mkdir("nested")
            with open("nested/test.bench.py", "w") as f:
                f.write("")

            resolved = resolve_pattern("nested/*")

        self.assertEqual(resolved, ["nested/test.bench.py"])
예제 #3
0
    def test_glob_cwd(self):
        with self.runner.isolated_filesystem():
            with open("test1.bench.py", "w") as f:
                f.write("")
            with open("test2.bench.py", "w") as f:
                f.write("")

            resolved = resolve_pattern("*")

        self.assertMatch(resolved, ["test1.bench.py", "test2.bench.py"])
예제 #4
0
    def test_glob_directory(self):
        with self.runner.isolated_filesystem():
            os.mkdir("nested")
            with open("nested/test1.bench.py", "w") as f:
                f.write("")
            with open("nested/test2.bench.py", "w") as f:
                f.write("")

            resolved = resolve_pattern("nested/*")

        self.assertMatch(resolved, ["nested/test1.bench.py", "nested/test2.bench.py"])
예제 #5
0
    def test_findall_cwd(self):
        with self.runner.isolated_filesystem():
            os.mkdir("nested")
            with open("nested/test1.bench.py", "w") as f:
                f.write("")
            with open("nested/test2.bench.py", "w") as f:
                f.write("")
            os.mkdir("nested2")
            with open("nested2/test1.bench.py", "w") as f:
                f.write("")
            with open("nested2/test2.bench.py", "w") as f:
                f.write("")

            resolved = resolve_pattern(".")

        expected = [
            "./nested/test1.bench.py",
            "./nested/test2.bench.py",
            "./nested2/test1.bench.py",
            "./nested2/test2.bench.py",
        ]

        self.assertMatch(resolved, expected)