-
Notifications
You must be signed in to change notification settings - Fork 125
Add Windows Test Runners for All Core Test Suites #1439
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
base: develop-windows
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status: ❌ ERROR
See detailed report in MegaLinter reports |
1630b42
to
32eb0f7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop-windows #1439 +/- ##
===================================================
- Coverage 81.37% 81.28% -0.10%
===================================================
Files 208 208
Lines 23566 23586 +20
Branches 3717 3723 +6
===================================================
- Hits 19177 19172 -5
- Misses 3132 3170 +38
+ Partials 1257 1244 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c9a0c97
to
e1771d6
Compare
83b2d1f
to
f660276
Compare
f660276
to
ff6be99
Compare
c33a036
to
29e450e
Compare
29e450e
to
3e3a2c3
Compare
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.
Posting this now so I can get this feedback to you-I'd like to take a closer look at the healthcheck section changes when I have some more time.
tox.ini
Outdated
@@ -44,6 +44,19 @@ setupdir = {toxinidir} | |||
; Fail tests when interpreters are missing. | |||
skip_missing_interpreters = false | |||
envlist = | |||
# Core Features Tests run on Linux, MacOS, and Windows | |||
python-agent_features-{py37,py38,py39,py310,py311,py312,py313}-{with,without}_extensions, |
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.
Didn't we want to only run on 3.13?
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.
Confusing change, but the python-
prefix now denotes default python runners with no dependencies, which is linux. The envs with windows-
as a prefix are for running on windows runners specifically. The line you're looking at is a linux only runner set, there's a windows env for agent features on just Python 3.13 down below.
@@ -522,7 +522,8 @@ def test_audit_logging(): | |||
protocol = AgentProtocol(settings, client_cls=HttpClientRecorder) | |||
protocol.send("preconnect") | |||
|
|||
with Path(f.name).open() as f: | |||
audit_log_path = Path(f.name) | |||
with audit_log_path.open() as f: |
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.
Should this have an encoding on it?
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.
No, the audit log file is being written to in the actual agent code in the preferred encoding as returned by locale.getencoding()
. We read it back in using the same default encoding.
The other tests that needed encoding specified are pre-written files from Mac/Linux machines that encode unicode characters in UTF-8, which is not the default for Windows and produces errors.
@@ -13,7 +13,6 @@ | |||
# limitations under the License. | |||
|
|||
import functools | |||
import sys |
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 don't understand how we are still finding these. Must have been missed in the original linted PR.
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 turned off the rule for unused imports in the tests folder because of fixtures commonly causing that to trip and get removed unless we mark them with # noqa
markers. Unfortunately, that means we don't catch unused imports in tests files but they're not run in production so I wasn't too concerned with it.
|
||
@pytest.mark.skipif(sys.platform != "win32", reason="Only valid for Windows") | ||
@pytest.mark.parametrize("leading_slash", [True, False], ids=["leading_slash", "no_leading_slash"]) | ||
def test_inconsistent_paths_on_windows(monkeypatch, tmp_path, leading_slash): |
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 feel like you went over this in mobbing but I can't remember now. Is this just because windows allows both ///
and //
so it must handle both?
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.
There are inconsistencies with handling the root path on windows that caused a ton of headaches due to mixing which library was creating vs parsing the file URIs.
A path for the file C:\\Users\\Reli\\myapp\\main.py
will end up represented as a URI with the file://
but both of these are valid for after the prefix:
c:/user/reli/myapp/main.py
and /c:/user/reli/myapp/main.py
.
It's hard to spot when it's file://c:/user/reli/myapp/main.py
vs file:///c:/user/reli/myapp/main.py
but the extra slash causes SOME parsers to fail due to interpreting the leading slash as "relative to the root", but there's no folder named c:
under the root, since that's a drive letter. It's effectively the same as looking for C:\\C:
. So the Path object produced from parsing that doesn't exist.
That being said, it SHOULD be valid on Windows as a URI but not every parser interprets it correctly. The parser with correct behavior is once again pathlib
, but the URI parser wasn't added until Python 3.13. Since we're now not aiming to support lower versions on Windows yet, I could comment out that whole section and call Path.from_uri() on 3.13+ to sidestep this whole thing.
os.environ.get("NEW_RELIC_AGENT_CONTROL_HEALTH_DELIVERY_LOCATION", "") or "file:///newrelic/apm/health" | ||
) | ||
|
||
return health_file_location | ||
# Return from cache if already parsed |
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'm gonna have to look at this part a little more in depth later.
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.
The health stuff is a significant enough change that I could pull it out into a separate PR and mark these tests as XFAIL for now if you want.
281960c
to
346bdba
Compare
346bdba
to
357154a
Compare
Overview