-
Notifications
You must be signed in to change notification settings - Fork 44
Feat/dev 3737 matrix update #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c43c66f
a4dc9f3
09bf43d
6aed7a2
d3cae07
74214f0
2dc9fcd
f5939af
c35676b
284c234
6aacf13
e844d51
0335997
abb88a3
ab6aa2b
4ce7a3d
eb72e7f
3c39698
b312f1e
edad78b
4331cbf
0fb80f4
02fedb5
347511b
de5b35e
9bfd2d5
f41166c
a33a562
416644a
ceadbab
97c5375
ba2c0c2
af0257a
73cdce0
8a60af2
1d2b826
b798bc3
0e89471
d326913
ecb0e94
0dec662
af68af5
29fda5a
0265035
735551b
b8f4b89
16d595c
cd03bdc
4396843
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| from importlib_metadata import version | ||
| from importlib.metadata import version | ||
|
|
||
| __version__ = version("gdc_client") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| import hashlib | ||
| import hmac | ||
| import multiprocessing | ||
| import tarfile | ||
| import time | ||
| import urllib.error | ||
| import urllib.request | ||
| from collections.abc import Iterable, Mapping | ||
| from io import BytesIO | ||
| from multiprocessing import Process | ||
| from unittest.mock import patch | ||
|
|
||
| import boto3 | ||
|
|
@@ -141,11 +143,32 @@ def run_mock_server(): | |
|
|
||
| @pytest.fixture(scope="class") | ||
| def setup_mock_server() -> None: | ||
| server = Process(target=run_mock_server) | ||
| # MacOS does things differently, so get everyone acting the same way | ||
| try: | ||
| ctx = multiprocessing.get_context("fork") | ||
| server = ctx.Process(target=run_mock_server) | ||
| except ValueError: | ||
| server = multiprocessing.Process(target=run_mock_server) | ||
|
|
||
| server.start() | ||
| time.sleep(5) # starting with py38, takes longer for process to start on macOS | ||
|
|
||
| # Since py38, a sleep is needed for MacOS. 10 is no longer enough as of py310 | ||
| # Instead of time.sleep(30), this loop could exit faster. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you seeing a significant reduction in the wait time for this? This increases complexity a bit and I might recommend just going with the 30 sec sleep if we're only saving a couple seconds.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can tell a difference on my machine when running sleep(30) instead of this loop, but how often does a person run the tests? Maybe taking longer and being less complex would be preferred |
||
| for _ in range(60): | ||
| try: | ||
| with urllib.request.urlopen("http://127.0.0.1:5000", timeout=1): | ||
| break | ||
| # listen for any response, and then stop waiting | ||
| except urllib.error.HTTPError: | ||
| break | ||
| except Exception: | ||
| time.sleep(0.5) | ||
| else: | ||
| raise RuntimeError("Mock server failed to start on 127.0.0.1:5000 in 30 secs.") | ||
|
|
||
| yield | ||
| server.terminate() | ||
| server.join() | ||
|
|
||
|
|
||
| @pytest.fixture | ||
|
|
||
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.
Was this something that changed for mac since py38?
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 can find stuff online saying this change from fork to spawn for just MacOS happened for python 3.8. I don't know how this wasn't an issue for previous builds using python 3.8 on MacOS, but for the build matrix steps, this was causing issues for testing as part of the build process.