Skip to content

Commit 938adb9

Browse files
ruromeroclaude
andcommitted
test(python): mock process.platform to make marker tests cross-platform
PEP 508 marker tests assume a Linux/POSIX environment. On Windows, the marker evaluator would include win32-gated packages, causing fixture mismatches. Override process.platform to 'linux' for the duration of the test suite so results are deterministic on any OS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 220fcd6 commit 938adb9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

test/providers/python_pyproject.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Python_poetry from '../../src/providers/python_poetry.js'
99
import Python_uv from '../../src/providers/python_uv.js'
1010

1111
let clock
12+
let originalPlatform
1213

1314
const TIMEOUT = process.env.GITHUB_ACTIONS ? 30000 : 15000
1415

@@ -590,4 +591,11 @@ suite('testing the python-pyproject data provider', () => {
590591
})
591592
})
592593

593-
}).beforeAll(() => clock = useFakeTimers(new Date('2023-10-01T00:00:00.000Z'))).afterAll(() => clock.restore())
594+
}).beforeAll(() => {
595+
originalPlatform = process.platform
596+
Object.defineProperty(process, 'platform', { value: 'linux', configurable: true })
597+
clock = useFakeTimers(new Date('2023-10-01T00:00:00.000Z'))
598+
}).afterAll(() => {
599+
Object.defineProperty(process, 'platform', { value: originalPlatform, configurable: true })
600+
clock.restore()
601+
})

0 commit comments

Comments
 (0)