Skip to content

Commit ed6a7a8

Browse files
authored
adding in the test_logger file and updating the readme to include ins… (#63)
* adding in the test_logger file and updating the readme to include installing Docker * update to test_logger file, adding to integration tests also * adding in docstring * ran yapf for style comformity * updating docstring of client.py to show how to increase verbosity of output
1 parent bd482a0 commit ed6a7a8

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ client = Client()
3434
Please consult `CONTRIB.md`
3535

3636
## Testing
37-
1. Update the `Makefile` with your `staging` or `prod` API key. Make sure the key is not from a free tier account.
37+
1. Update the `Makefile` with your `staging` or `prod` API key. Ensure that docker has been installed on your system. Make sure the key is not from a free tier account.
3838
2. To test on `staging`:
3939
```
4040
make test-staging

labelbox/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ def __init__(self,
4444
labelbox.exceptions.AuthenticationError: If no `api_key`
4545
is provided as an argument or via the environment
4646
variable.
47+
48+
Logging:
49+
Logging is defaulted to level WARNING. To receive more verbose
50+
output to console, update logging.level to the
51+
appropriate level.
52+
53+
Example:
54+
#get updated on console when client is instantiated
55+
import logger
56+
57+
logging.basicConfig(level = logging.INFO)
58+
client = Client("<APIKEY>")
4759
"""
4860
if api_key is None:
4961
if _LABELBOX_API_KEY not in os.environ:

tests/integration/test_logger.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from labelbox import Client
2+
import pytest
3+
import logging
4+
5+
6+
def test_client_log(caplog, project):
7+
"""
8+
This file tests that the logger will properly output to the console after updating logging level
9+
10+
The default level is set to WARNING
11+
12+
There is an expected output after setting logging level to DEBUG
13+
"""
14+
15+
project.export_labels()
16+
assert '' == caplog.text
17+
18+
with caplog.at_level(logging.DEBUG):
19+
project.export_labels()
20+
assert "label export, waiting for server..." in caplog.text

0 commit comments

Comments
 (0)