Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit c8620f2

Browse files
authored
Injest test infra changes (#3418)
1 parent f684c1d commit c8620f2

7,611 files changed

Lines changed: 2639 additions & 1609 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
Ingest test infrastructure changes in `@typespec/http-client-python`

cspell.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ words:
8787
- npmjs
8888
- odata
8989
- overriden
90+
- pkgs
9091
- psscriptanalyzer
9192
- ptvsd
9293
- pylint
@@ -126,12 +127,14 @@ words:
126127
- tikka
127128
- toctree
128129
- tspd
130+
- unconfigure
129131
- undoc
130132
- venv
131133
- venvtools
132134
- wday
133135
- westus
134136
- windowsvmimage
137+
- xdist
135138
- xmsclientrequestid
136139
- xmserrorresponse
137140
- xmserrorresponseversiontolerant

eng/pipelines/ci-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ steps:
128128

129129
- script: node ../../../eng/scripts/check-for-changed-files.js
130130
displayName: Fail on regeneration diff in Typespec
131-
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/test
131+
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/tests
132132
condition: and(succeeded(), ${{ parameters.regenerate }}, ${{ parameters.checkChange }}, eq(variables['Agent.OS'], 'Linux'))
133133

134134
- script: node ../../../eng/scripts/check-for-changed-files.js

eng/pipelines/generated-code-checks-template.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@ parameters:
33
package: "autorest.python"
44

55
steps:
6-
- script: npm run test -- --command=ci --folder=${{ parameters.folderName }}
6+
- script: npm run test -- --env=ci --flavor=${{ parameters.folderName }}
77
displayName: Execute ${{ parameters.folderName }} tests - Python $(PythonVersion)
88
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.package}}
99

10-
- script: npm run test -- --command=lint --folder=${{ parameters.folderName }}
11-
displayName: Lint ${{ parameters.folderName }} - Python $(PythonVersion) --folder=${{ parameters.folderName }}
10+
- script: npm run test -- --env=lint --flavor=${{ parameters.folderName }}
11+
displayName: Lint ${{ parameters.folderName }} - Python $(PythonVersion)
1212
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.package}}
13-
condition: and(eq(variables['PythonVersion'], '3.9'), or(contains( '${{ parameters.folderName }}', 'version-tolerant'), eq('${{parameters.package}}', 'typespec-python')))
13+
condition: and(eq(variables['PythonVersion'], '3.9'), or(contains('${{ parameters.folderName }}', 'version-tolerant'), eq('${{parameters.package}}', 'typespec-python')))
1414

15-
- script: npm run test -- --command=mypy --folder=${{ parameters.folderName }}
15+
- script: npm run test -- --env=mypy --flavor=${{ parameters.folderName }}
1616
displayName: Mypy ${{ parameters.folderName }} - Python $(PythonVersion)
1717
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.package}}
1818
condition: and(eq(variables['PythonVersion'], '3.11'), or(contains('${{ parameters.folderName }}', 'version-tolerant'), eq('${{parameters.package}}', 'typespec-python')))
1919

20-
- script: npm run test -- --command=pyright --folder=${{ parameters.folderName }}
20+
- script: npm run test -- --env=pyright --flavor=${{ parameters.folderName }}
2121
displayName: Pyright ${{ parameters.folderName }} - Python $(PythonVersion)
2222
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.package}}
2323
condition: and(eq(variables['PythonVersion'], '3.10'), or(contains('${{ parameters.folderName }}', 'version-tolerant'), eq('${{parameters.package}}', 'typespec-python')))
2424

25-
- script: npm run test -- --command=apiview --folder=${{ parameters.folderName }}
25+
# docs/apiview only for typespec-python (removed from autorest.python to reduce CI time)
26+
- script: npm run test -- --env=docs --flavor=${{ parameters.folderName }}
2627
displayName: ApiView ${{ parameters.folderName }} - Python $(PythonVersion)
2728
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.package}}
28-
condition: eq(variables['PythonVersion'], '3.11')
29+
condition: and(eq(variables['PythonVersion'], '3.11'), eq('${{parameters.package}}', 'typespec-python'))

eng/pipelines/internal-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ steps:
2323
regenerate: true
2424

2525
- script: |
26-
tox run -e ci
26+
tox run -e ci-unbranded
2727
displayName: Mock Api Tests for Unbranded
28-
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/test/unbranded
28+
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/tests
2929
3030
- task: AzureCLI@2
3131
displayName: Upload scenario manifest for unbranded
@@ -37,9 +37,9 @@ steps:
3737
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/node_modules/@typespec/http-specs
3838

3939
- script: |
40-
tox run -e ci
40+
tox run -e ci-azure
4141
displayName: Mock Api Tests for Azure
42-
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/test/azure
42+
workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/tests
4343
4444
- task: AzureCLI@2
4545
displayName: Upload scenario manifest for azure

packages/autorest.python/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjA4ODMyMy9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.2.tgz",
32+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjEwOTY3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.2.tgz",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "^4.21.0"
@@ -47,4 +47,4 @@
4747
"requirements.txt",
4848
"generator/"
4949
]
50-
}
50+
}

packages/autorest.python/scripts/eng/run-tests.ts

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import { fileURLToPath } from "url";
88

99
interface Arguments {
1010
validFolders: string[];
11-
folder?: string;
12-
command?: string;
11+
flavor?: string;
12+
env?: string;
1313
name?: string;
1414
}
1515

16-
const validCommands = ["ci", "lint", "mypy", "pyright", "apiview"];
16+
// Note: apiview removed to reduce CI time - it was causing timeouts
17+
const validEnvs = ["ci", "lint", "mypy", "pyright"];
1718

1819
// Parse command-line arguments using yargs
1920
const argv = yargs(hideBin(process.argv))
@@ -23,15 +24,15 @@ const argv = yargs(hideBin(process.argv))
2324
type: "array",
2425
default: ["azure", "unbranded"],
2526
})
26-
.option("folder", {
27-
alias: "f",
28-
describe: "Specify the folder to use",
27+
.option("flavor", {
28+
alias: ["f", "folder"],
29+
describe: "Specify the flavor/folder to use",
2930
type: "string",
3031
})
31-
.option("command", {
32-
alias: "c",
33-
describe: "Specify the command to run",
34-
choices: validCommands,
32+
.option("env", {
33+
alias: ["e", "command"],
34+
describe: "Specify the environment/command to run",
35+
choices: validEnvs,
3536
type: "string",
3637
})
3738
.option("name", {
@@ -40,16 +41,16 @@ const argv = yargs(hideBin(process.argv))
4041
type: "string",
4142
}).argv as Arguments;
4243

43-
const foldersToProcess = argv.folder ? [argv.folder] : argv.validFolders;
44+
const foldersToProcess = argv.flavor ? [argv.flavor] : argv.validFolders;
4445

45-
const commandToRun = argv.command || "all";
46+
const envToRun = argv.env || "all";
4647

47-
function getCommand(command: string, folder: string, name?: string): string {
48-
if (!validCommands.includes(command)) throw new Error(`Unknown command '${command}'.`);
48+
function getCommand(env: string, folder: string, name?: string): string {
49+
if (!validEnvs.includes(env)) throw new Error(`Unknown env '${env}'.`);
4950

5051
// Check if running on Windows
5152
const isWindows = process.platform === "win32";
52-
const baseCommand = `tox -c ./test/${folder}/tox.ini -e ${command}`;
53+
const baseCommand = `tox -c ./test/${folder}/tox.ini -e ${env}`;
5354

5455
let retval: string;
5556
if (isWindows) {
@@ -66,33 +67,33 @@ function getCommand(command: string, folder: string, name?: string): string {
6667
return retval;
6768
}
6869

69-
function sectionExistsInToxIni(command: string, folder: string): boolean {
70+
function sectionExistsInToxIni(env: string, folder: string): boolean {
7071
const toxIniPath = join(fileURLToPath(import.meta.url), `../../../test/${folder}/tox.ini`);
7172
const toxIniContent = readFileSync(toxIniPath, "utf-8");
72-
const sectionHeader = `[testenv:${command}]`;
73+
const sectionHeader = `[testenv:${env}]`;
7374
return toxIniContent.includes(sectionHeader);
7475
}
7576

76-
function myExecSync(command: string, folder: string, name?: string): void {
77-
if (!sectionExistsInToxIni(command, folder)) {
78-
console.log(`No section for ${command} in tox.ini for folder ${folder}. Skipping...`);
77+
function myExecSync(env: string, folder: string, name?: string): void {
78+
if (!sectionExistsInToxIni(env, folder)) {
79+
console.log(`No section for ${env} in tox.ini for folder ${folder}. Skipping...`);
7980
return;
8081
}
81-
execSync(getCommand(command, folder, name), { stdio: "inherit" });
82+
execSync(getCommand(env, folder, name), { stdio: "inherit" });
8283
}
8384

8485
foldersToProcess.forEach((folder) => {
8586
try {
86-
if (commandToRun === "all") {
87-
for (const key of validCommands) {
87+
if (envToRun === "all") {
88+
for (const key of validEnvs) {
8889
console.log(`Running ${key} for folder ${folder}...`);
8990
myExecSync(key, folder, argv.name);
9091
}
91-
} else if (getCommand(commandToRun, folder, argv.name)) {
92-
console.log(`Running ${commandToRun} for folder ${folder}...`);
93-
myExecSync(commandToRun, folder, argv.name);
92+
} else if (getCommand(envToRun, folder, argv.name)) {
93+
console.log(`Running ${envToRun} for folder ${folder}...`);
94+
myExecSync(envToRun, folder, argv.name);
9495
} else {
95-
console.error(`Error: Unknown command '${commandToRun}'.`);
96+
console.error(`Error: Unknown env '${envToRun}'.`);
9697
process.exit(1);
9798
}
9899
} catch (error) {

packages/typespec-python/.c8rc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/typespec-python/.mocharc.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trailingComma: "all"
2+
printWidth: 120
3+
quoteProps: "consistent"
4+
endOfLine: lf
5+
arrowParens: always

0 commit comments

Comments
 (0)