generated from allenai/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconftest.py
44 lines (29 loc) · 869 Bytes
/
conftest.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import logging
import sys
import pytest
from beaker import Beaker
logger = logging.getLogger(__name__)
def _get_unique_name() -> str:
from gantry.util import unique_name
return unique_name()
@pytest.fixture
def run_name() -> str:
return _get_unique_name()
@pytest.fixture
def workspace_name() -> str:
return "ai2/gantry-testing"
@pytest.fixture
def public_workspace_name() -> str:
return "ai2/gantry-testing-public"
@pytest.fixture()
def beaker(workspace_name):
beaker_client = Beaker.from_env(default_workspace=workspace_name, default_org="ai2")
return beaker_client
if __name__ == "__main__":
beaker_client = Beaker.from_env()
assert len(sys.argv) == 2
fixture = sys.argv[-1]
if fixture == "run_name":
print(_get_unique_name())
else:
raise ValueError(f"Bad fixture argument '{fixture}'")