Skip to content

Commit a06ed41

Browse files
authored
test: use python instead of python3 (#783)
Signed-off-by: behnazh-w <[email protected]>
1 parent 0818326 commit a06ed41

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ repos:
165165
hooks:
166166
- id: integration-test-vet
167167
name: validate integration test cases
168-
entry: python3
168+
entry: python
169169
args:
170170
- ./tests/integration/run.py
171171
- vet

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ make docs
1313
This command will build and generate the documentation into `docs/_build/html`. To view it locally, run (with the dev environment activated):
1414

1515
```
16-
python3 -m http.server -d docs/_build/html
16+
python -m http.server -d docs/_build/html
1717
```
1818

1919
## Extend the API reference

scripts/dev_scripts/integration_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ run_macaron_clean $ANALYZE -purl pkg:maven/io.github.behnazh-w.demo/example-mave
397397

398398
check_or_update_expected_output $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
399399

400-
python3 ./tests/integration/run.py run \
400+
python ./tests/integration/run.py run \
401401
./tests/integration/cases/... || log_fail
402402

403403
# Important: This should be at the end of the file

scripts/dev_scripts/integration_tests_docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ python $COMPARE_POLICIES $POLICY_RESULT $POLICY_EXPECTED || log_fail
5858
# Clean up and remove the virtual environment.
5959
rm -rf "$VIRTUAL_ENV_PATH"
6060

61-
python3 ./tests/integration/run.py run \
61+
python ./tests/integration/run.py run \
6262
--macaron scripts/release_scripts/run_macaron.sh \
6363
--include-tag docker \
6464
./tests/integration/cases/... || log_fail

tests/integration/README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
We have an integration test utility script, [`./tests/integration/run.py`](./run.py), for running integration tests. The script should be called within the dev virtual environment and from the root directory of the repository.
77

88
```bash
9-
$ python3 ./tests/integration/run.py -h
9+
$ python ./tests/integration/run.py -h
1010
usage: ./tests/integration/run.py [-h] {check,vet,run,update} ...
1111

1212
positional arguments:
@@ -26,7 +26,7 @@ The utility offers 4 different commands, as shown in the help message above. Som
2626
2727
```bash
2828
# Show help message for the check command.
29-
$ python3 ./tests/integration/run.py check -h
29+
$ python ./tests/integration/run.py check -h
3030
```
3131
3232
@@ -81,21 +81,21 @@ You create a new test case by creating a new directory, then a `test.yaml` withi
8181
8282
```bash
8383
# Schema-validate the ./test/case/directory/test.yaml file.
84-
$ python3 ./tests/integration/run.py check ./test/case/directory
84+
$ python ./tests/integration/run.py check ./test/case/directory
8585
```
8686
8787
At this point, some expected result files do not exist yet, since you normally want to run `macaron` once, inspect the result files, then turn them into expected result files if they look good enough. To do this, you can run in **interactive** mode. In this mode, the utility stops at each step and asks if you want to run or skip a step. For `compare` steps, the utility also asks if you want to "update" the expected result file instead of compare.
8888
8989
```bash
9090
# Run a test case in interactive mode.
91-
$ python3 ./tests/integration/run.py run -i ./test/case/directory
91+
$ python ./tests/integration/run.py run -i ./test/case/directory
9292
```
9393
9494
After you have finished running the test case, you can rerun the test case to make sure everything works as expected.
9595
9696
```bash
9797
# Run a test case end-to-end.
98-
$ python3 ./tests/integration/run.py run ./test/case/directory
98+
$ python ./tests/integration/run.py run ./test/case/directory
9999
```
100100
101101
### Inspect test cases
@@ -104,7 +104,7 @@ Besides the interactive mode, the `run` command also has another special mode ca
104104
105105
```bash
106106
# Run a test case in dry-run mode.
107-
$ python3 ./tests/integration/run.py run -d ./test/case/directory
107+
$ python ./tests/integration/run.py run -d ./test/case/directory
108108
```
109109
110110
### Validate test cases before pushing commits to remote or running in CI
@@ -119,14 +119,14 @@ All commands (`check`, `vet`, `run`, and `update`) can process multiple test cas
119119
120120
```bash
121121
# Run two test cases one after another.
122-
$ python3 ./tests/integration/run.py run ./test_case_a/directory ./test_case_b/directory
122+
$ python ./tests/integration/run.py run ./test_case_a/directory ./test_case_b/directory
123123
```
124124
125125
You can also use the `...` path wildcard to allow for discovering test case directories recursively under a root directory.
126126
127127
```bash
128128
# Run all test cases discovered recursively under a directory.
129-
$ python3 ./tests/integration/run.py run ./all/cases/...
129+
$ python ./tests/integration/run.py run ./all/cases/...
130130
```
131131
132132
### Select a subset of test cases to run
@@ -147,21 +147,21 @@ We typically have the test cases for the container image being a subset of the t
147147
148148
```bash
149149
# Test the container image with test cases having the `docker` tag.
150-
$ python3 ./tests/integration/run.py run --include-tag docker ./all/cases/...
150+
$ python ./tests/integration/run.py run --include-tag docker ./all/cases/...
151151
```
152152
153153
The `--include-tag` flag can be specified multiple times. A selected test case must contain all tags specified with the `--include-tag` flag.
154154
155155
```bash
156156
# Test the container image with test cases having the `docker` tag.
157-
$ python3 ./tests/integration/run.py run --include-tag tag-a --include-tag tag-b ./all/cases/...
157+
$ python ./tests/integration/run.py run --include-tag tag-a --include-tag tag-b ./all/cases/...
158158
```
159159
160160
There is also the `--exclude-tag` flag. A selected test case must also not contain any tag specified with the `--exclude-tag` flag.
161161
162162
```bash
163163
# Only run test cases not tagged with `npm`.
164-
$ python3 ./tests/integration/run.py run --exclude-tag npm ./all/cases/...
164+
$ python ./tests/integration/run.py run --exclude-tag npm ./all/cases/...
165165
```
166166
167167
You can simply think of each `--include-tag`/`--exclude-tag` argument as adding an additional constraint that a selected test case must satisfy".

tests/integration/run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def cmd(self, macaron_cmd: str) -> list[str]:
252252
result_file = self.options["result"]
253253
expected_file = self.options["expected"]
254254
return [
255-
"python3",
255+
"python",
256256
os.path.abspath(os.path.join(*COMPARE_SCRIPTS[kind])),
257257
*[result_file, expected_file],
258258
]
@@ -276,7 +276,7 @@ def update_result(self, cwd: str) -> int:
276276
if kind == "vsa":
277277
proc = subprocess.run(
278278
args=[
279-
"python3",
279+
"python",
280280
os.path.abspath(os.path.join(*COMPARE_SCRIPTS[kind])),
281281
"--update",
282282
*[result_file, expected_file],

0 commit comments

Comments
 (0)