diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 756909ef..9b007fac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,8 @@ jobs: artifact: linux reqs_file: requirements_full.txt + container: ghcr.io/LagoLunatic/wwrando-test-files:main + runs-on: ${{ matrix.os }} env: @@ -63,6 +65,14 @@ jobs: if: runner.os == 'Linux' run: | /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX + - name: Extract test files + uses: edgarrc/action-7z@v1 + with: + args: 7z x /wwrando-files/GZLE01-stripped.7z -o/wwrando-files/ + - name: Prepare test env vars + run: | + echo "WW_GZLE01_STRIPPED_PATH=/wwrando-files/WW Stripped ISO.iso" > .env + echo "WW_RANDO_OUTPUT_DIR=/wwrando-output" > .env - name: Test with pytest run: | pip install pytest pytest-cov diff --git a/.gitignore b/.gitignore index 52a6639f..ba1ba346 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ profileresults*.prof /.venv /site .coverage +.env diff --git a/requirements_full.txt b/requirements_full.txt index d4fc87b5..69760aaa 100644 --- a/requirements_full.txt +++ b/requirements_full.txt @@ -10,3 +10,4 @@ PyInstaller~=6.8.0 pytest~=7.4.0 pytest-cov~=4.1.0 pytest-qt~=4.2.0 +python-dotenv~=1.0.1 diff --git a/requirements_qt5_full.txt b/requirements_qt5_full.txt index e7081cd2..dae67aa9 100644 --- a/requirements_qt5_full.txt +++ b/requirements_qt5_full.txt @@ -10,3 +10,4 @@ PyInstaller~=6.8.0 pytest~=7.4.0 pytest-cov~=4.1.0 pytest-qt~=4.2.0 +python-dotenv~=1.0.1 diff --git a/test/test_dry.py b/test/test_dry.py index ad36938c..d8f29959 100644 --- a/test/test_dry.py +++ b/test/test_dry.py @@ -1,6 +1,7 @@ +import os from wwrando import make_argparser from randomizer import WWRandomizer -from options.wwrando_options import Options, SwordMode, EntranceMixMode, TrickDifficulty +from options.wwrando_options import Options, TrickDifficulty from enum import StrEnum from test_helpers import * @@ -9,7 +10,7 @@ def dry_rando_with_options(options) -> WWRandomizer: rando_kwargs = { "seed": "pytestseed", "clean_iso_path": None, - "randomized_output_folder": "./rando_output", + "randomized_output_folder": os.environ["WW_RANDO_OUTPUT_DIR"], "options": options, "cmd_line_args": args, } diff --git a/test/test_save.py b/test/test_save.py new file mode 100644 index 00000000..59917571 --- /dev/null +++ b/test/test_save.py @@ -0,0 +1,22 @@ +import os +from wwrando import make_argparser +from randomizer import WWRandomizer +from options.wwrando_options import Options +from test_helpers import * + +def rando_with_options(options) -> WWRandomizer: + args = make_argparser().parse_args(args=["--nologs"]) + rando_kwargs = { + "seed": "pytestseed", + "clean_iso_path": os.environ["WW_GZLE01_STRIPPED_PATH"], + "randomized_output_folder": os.environ["WW_RANDO_OUTPUT_DIR"], + "options": options, + "cmd_line_args": args, + } + os.makedirs(rando_kwargs["randomized_output_folder"], exist_ok=True) + return WWRandomizer(**rando_kwargs) + +def test_default_options(): + options = Options() + rando = rando_with_options(options) + rando.randomize_all()