1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2024-11-21 22:19:24 +00:00

Fix tests for update-environment==false

This commit is contained in:
mayeut 2022-07-02 11:40:53 +02:00
parent 78a2330b92
commit 412091c1e0
No known key found for this signature in database
GPG key ID: 8B03CED67D3ABFBA
2 changed files with 8 additions and 2 deletions

View file

@ -151,8 +151,11 @@ describe('findPyPyVersion', () => {
let spyChmodSync: jest.SpyInstance;
let spyCoreAddPath: jest.SpyInstance;
let spyCoreExportVariable: jest.SpyInstance;
const env = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...env};
tcFind = jest.spyOn(tc, 'find');
tcFind.mockImplementation((tool: string, version: string) => {
const semverRange = new semver.Range(version);
@ -214,6 +217,7 @@ describe('findPyPyVersion', () => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
process.env = env;
});
it('found PyPy in toolcache', async () => {

View file

@ -28,10 +28,12 @@ const manifestData = require('./data/versions-manifest.json');
describe('Finder tests', () => {
let spyCoreAddPath: jest.SpyInstance;
let spyCoreExportVariable: jest.SpyInstance;
const env = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...env};
spyCoreAddPath = jest.spyOn(core, 'addPath');
spyCoreExportVariable = jest.spyOn(core, 'exportVariable');
});
@ -39,6 +41,7 @@ describe('Finder tests', () => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
process.env = env;
});
it('Finds Python if it is installed', async () => {
@ -66,7 +69,6 @@ describe('Finder tests', () => {
await finder.useCpythonVersion('3.x', 'x64', false);
expect(spyCoreAddPath).not.toHaveBeenCalled();
expect(spyCoreExportVariable).not.toHaveBeenCalled();
expect(spyCoreExportVariable).not.toHaveBeenCalled();
});
it('Finds stable Python version if it is not installed, but exists in the manifest', async () => {