-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_repo.py
More file actions
26 lines (22 loc) · 1.07 KB
/
test_repo.py
File metadata and controls
26 lines (22 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pytest
# import asyncio
from hackbot.src.pocgen.repo import Repository
from hackbot.tests.test_template import slow_and_nondeterministic_test, TestTemplate
# from hackbot.src.pocgen.runtime_environment import LocalEnvironment
from common.utils import tempfiles
from hackbot.utils.git.clone import clone_repository
class TestRepo(TestTemplate):
@pytest.fixture(autouse=True)
def setup_method(self, setup):
pass
@pytest.mark.asyncio
@pytest.mark.parametrize("repo_url", [
"https://github.com/code-423n4/2022-04-backed"
])
@slow_and_nondeterministic_test
async def test_deps_and_compile_with_agent(self, repo_url: str):
with tempfiles.TemporaryDirectory() as temp_dir:
clone_repository(repo_url, target_dir=temp_dir)
async with Repository(from_dir=temp_dir) as repo:
result = await repo.deps_and_compile()
assert result.exit_code == 0, f"Compilation failed with exit code {result.exit_code}\\nSTDOUT:\\n{result.stdout}\\nSTDERR:\\n{result.stderr}"