Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
executing tests on Windows system on command line throws issues with file paths and floating point maths, producing different results compared to tests on other systems
Comment | File | Size | Author |
---|---|---|---|
#2 | 2923563-1.patch | 3.14 KB | hughmccracken |
|
Comments
Comment #2
hughmccracken CreditAttribution: hughmccracken as a volunteer commentedsuggested patch to remove errors associated with testing on 64-bit Win, when testing command line
Comment #3
dman CreditAttribution: dman as a volunteer commented(on a non-windows system)
Patch applies clean.
Running tests exposes no new regressions.
So, although I can't replicate the Windows-specific weaknesses that this was fixing, I can confirm that these improvements do not damage the pre-existing tests.
Comment #4
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI wonder why
DirectoryFetcherTest::testEmptyDirectory()
doesn't cause issues as that has/
as well for separating the directories?Good idea to introduce a constant for the "magic number"
0.99
, although the constant itself doesn't make it more descriptive. I remember that in the D7 version of Feeds there were also some issues with that floating point number. See #2624344: Import via pushImport() keeps looping / never completes. Not sure if that helps.Comment #5
dman CreditAttribution: dman as a volunteer commentedThe difference between tests there is that most of the time, passing “incorrect” directory separators down to the underlying windows system just works. They are interpreted on the fly, so the issue is often transparent.
On the failing tests however, they were doing direct string comparisons between a raw string and a system-normalized one. On win, both paths would have been interpreted as equivalent, yet the strings were not identical.
Fwiw, it was only the TEST itself that fails, it doesn’t expose any actual windows bug.
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedAlright, but the patch still needs work. I see that
$this->progress
is getting rounded here. This will cause issues if there are more than 20 items to be imported. For example: if there are 100 items to be imported running in batches of 5, then at a certain point 95 items will be imported and$this->progress
will be 0.95. If you round that variable with a precision of 1 (as is done in the patch),round($this->progress, 1)
will evaluate to 1 and thus equalStateInterface::BATCH_COMPLETE
and import will be stopped. The last 5 five items will thus not be imported.Maybe the issue here is that
$this->progress
should be cast to a float first?.