-
Notifications
You must be signed in to change notification settings - Fork 8
Addressing Issue: Temporary failure in name resolution #84
Conversation
…iling tests cases that could not retrieve 'G3_HOSTNAME' variable.
…reeze. Without skipping new tests, pytest could not run the entire test suite.
Just realized that you are using |
examples/streamgazertsp.py
Outdated
if "gaze2d" in gaze: | ||
gaze2d = gaze["gaze2d"] | ||
logging.info(f"Gaze2d: {gaze2d[0]:9.4f},{gaze2d[1]:9.4f}") | ||
h, w = img.shape[:2] | ||
fix = (int(gaze2d[0] * w), int(gaze2d[1] * h)) | ||
img = cv2.circle(img.copy(), fix, 10, (0, 0, 255), 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition with the gaze overlay. Is it really necessary to copy the image? isn't it better to just draw on the original image (without setting the img-variable again)?
https://www.geeksforgeeks.org/python-opencv-cv2-circle-method/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried locally to remove the copy and the assignment and it still worked like a charm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right, will make those changes.
@@ -65,3 +65,6 @@ skip_gitignore = true | |||
[tool.pytest.ini_options] | |||
asyncio_mode = "auto" | |||
testpaths = ["tests"] | |||
|
|||
# Timeout | |||
faulthandler_timeout=30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nice addition. A failed test is a better test than a non-terminating test.
@@ -9,6 +9,7 @@ async def test_get_name(g3: Glasses3): | |||
assert await g3.recordings.get_name() == "recordings" | |||
|
|||
|
|||
@pytest.mark.skip(reason="Test causes pytest to freeze") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test freeze even after the timeout was added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would cause the test suite to hang and not continue.
Thanks for your contribution. The gaze overlay and the timeout are nice changes and if you submit them as separate PRs I'd be happy to approve them. I need to refresh my memory on the details on the .env file and tests. stay tuned. |
the .env-file should be in the root folder (mentioned in the readme.md). When you have this, there is no need to call env.load_dotenv() in the main library. Since a real client application is unlikely to expect the hostname to be specified like this it is better to call |
…ts best to not modify test suite.
… example runnable.
Sorry for the delay, winter break + project deadline. Thank you for your helpful comments. I have removed the |
…rted to using frame variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks @edavalosanaya !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks @edavalosanaya !
There are some code formatting errors. I'll resolve them and get this fix merged. |
This PR is made to address #82. It is composed of three commits:
dotenv
to the__init__.py
of theg3pylib
package to ensure that theG3_HOSTNAME
environmental variable is loaded when the package is loaded. Not sure if this is the desired behavior, as the examples all perform this function within their mains. Having this as default would benefit the tests, as the loading of the environmental variables was not performed, causing certain tests to fail.pytest
. I added@pytest.mark.skip
to these offending tests. Now the test suite should be able to run, yet it still has some failing tests. Also added a timeout for tests.streamgazerstp.py
example felt lacking in that it would not show the gaze on the video. Just made OpenCV draw the gaze on the video.NOTES:
Used
pre-commit
.Best,
Eduardo Davalos