Skip to content

Commit

Permalink
Make test scripts less path dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
martis42 committed May 5, 2024
1 parent be182bb commit 2a731da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ jobs:
- uses: actions/checkout@v4
- name: Integration tests - Aspect
if: runner.os != 'Windows'
run: |
cd test
cd aspect
python execute_tests.py
run: python test/aspect/execute_tests.py
- name: Integration tests - Aspect
if: runner.os == 'Windows'
run: |
Expand Down Expand Up @@ -84,10 +81,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Integration tests - Examples
run: |
cd examples
python test.py
run: python examples/test.py
- name: Integration tests - Examples with legacy WORKSPACE setup
run: |
cd examples
python test.py --legacy-workspace
run: python examples/test.py --legacy-workspace
6 changes: 6 additions & 0 deletions examples/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import sys
from argparse import ArgumentParser, Namespace
from dataclasses import dataclass
from os import chdir
from pathlib import Path

logging.basicConfig(format="%(message)s", level=logging.INFO)

Expand Down Expand Up @@ -138,4 +140,8 @@ def main(legacy_workspace: bool) -> int:

if __name__ == "__main__":
args = cli()

# Ensure we can invoke the script from various places
chdir(Path(__file__).parent)

sys.exit(main(args.legacy_workspace))
6 changes: 6 additions & 0 deletions test/aspect/execute_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
import logging
from argparse import ArgumentParser, Namespace
from os import chdir
from pathlib import Path
from sys import exit

from execution_logic import main
Expand Down Expand Up @@ -92,6 +94,10 @@ def cli() -> Namespace:
args = cli()
if args.verbose:
logging.getLogger().setLevel(logging.DEBUG)

# Ensure we can invoke the script from various places
chdir(Path(__file__).parent)

exit(
main(
tested_versions=TESTED_VERSIONS,
Expand Down
9 changes: 3 additions & 6 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ cd -
echo ""
echo "Execute integration tests - Aspect"
echo ""
cd test/aspect
./execute_tests.py
cd -
./test/aspect/execute_tests.py

echo ""
echo "Execute integration tests - Applying fixes"
Expand All @@ -47,10 +45,9 @@ echo ""
echo ""
echo "Execute integration tests - Examples with bzlmod"
echo ""
cd examples
./test.py
./examples/test.py

echo ""
echo "Execute integration tests - Examples with WORKSPACE setup"
echo ""
./test.py --legacy-workspace
./examples/test.py --legacy-workspace

0 comments on commit 2a731da

Please sign in to comment.