forked from Labelbox/labelbox-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
30 lines (22 loc) · 790 Bytes
/
conftest.py
File metadata and controls
30 lines (22 loc) · 790 Bytes
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
import glob
from datetime import datetime
from random import randint
from string import ascii_letters
import pytest
pytest_plugins = [
fixture_file.replace("tests/", "").replace("/", ".").replace(".py", "")
for fixture_file in glob.glob(
"tests/integration/annotation_import/fixtures/[!__]*.py",)
]
@pytest.fixture(scope="session")
def rand_gen():
def gen(field_type):
if field_type is str:
return "".join(ascii_letters[randint(0,
len(ascii_letters) - 1)]
for _ in range(16))
if field_type is datetime:
return datetime.now()
raise Exception("Can't random generate for field type '%r'" %
field_type)
return gen