Skip to content

Commit 9a58f9d

Browse files
authored
Merge pull request #108 from Labelbox/gs/tests-fixes
Fixes in tests
2 parents 0a503d5 + 94b2ada commit 9a58f9d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ jobs:
7373
7474
LABELBOX_TEST_API_KEY_STAGING: ${{ secrets.STAGING_LABELBOX_API_KEY }}
7575
run: |
76-
tox -e py -- -svv
76+
tox -e py -- -svvx

tests/integration/test_client_errors.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ def test_semantic_error(client):
4343
assert excinfo.value.message.startswith("Cannot query field \"bbb\"")
4444

4545

46-
def test_timeout_error(client):
46+
def test_timeout_error(client, project):
47+
time.sleep(60) #Fails to connect if we don't wait
4748
with pytest.raises(labelbox.exceptions.TimeoutError) as excinfo:
48-
client.execute("{projects {id}}", check_naming=False, timeout=0.001)
49+
query_str = """query getOntology {
50+
project (where: {id: $%s}) {
51+
ontology {
52+
normalized
53+
}
54+
}
55+
} """ % (project.uid)
56+
client.execute(query_str, check_naming=False, timeout=0.01)
4957

5058

5159
def test_query_complexity_error(client):

tests/integration/test_ontology.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
from typing import Any, Dict, List, Union
3+
from labelbox import LabelingFrontend
34

45

56
def sample_ontology() -> Dict[str, Any]:
@@ -33,7 +34,9 @@ def sample_ontology() -> Dict[str, Any]:
3334

3435
def test_create_ontology(client, project) -> None:
3536
""" Tests that the ontology that a project was set up with can be grabbed."""
36-
frontend = list(client.get_labeling_frontends())[0]
37+
frontend = list(
38+
client.get_labeling_frontends(
39+
where=LabelingFrontend.name == "Editor"))[0]
3740
project.setup(frontend, sample_ontology())
3841
normalized_ontology = project.ontology().normalized
3942

0 commit comments

Comments
 (0)