Skip to content

Commit

Permalink
Move test_results and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Baekalfen committed Oct 25, 2023
1 parent 7b8cf00 commit e4b07a3
Show file tree
Hide file tree
Showing 232 changed files with 72 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ default_rom/default_rom.sym
test.replay
ci_secrets.tar

mooneye/
blargg/
GB Tests/
SameSuite/
/mooneye/
/blargg/
/GB Tests/
/SameSuite/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="README/pyboy.svg" width="480">
<img src="extras/README/pyboy.svg" width="480">
</p>

__If you have any questions, or just want to chat, [join us on Discord](https://discord.gg/Zrf2nyH).__
Expand All @@ -20,7 +20,7 @@ Generate GIF with the layout and captions
<tr>
<td colspan="3">
<div align="center">
<img src="README/1.gif" width="400"><br>
<img src="extras/README/1.gif" width="400"><br>
</div>
</td>
</tr>
Expand All @@ -34,13 +34,13 @@ Generate GIF with the layout and captions
</tr>
<tr>
<td align="center">
<img src="README/5.gif" width="200">
<img src="extras/README/5.gif" width="200">
</td>
<td align="center">
<img src="README/7.gif" width="200">
<img src="extras/README/7.gif" width="200">
</td>
<td align="center">
<img src="README/6.gif" width="200">
<img src="extras/README/6.gif" width="200">
</td>
</tr>
</tbody>
Expand Down
Binary file added extras/README/1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/5.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/6.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/7.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/DebugExample2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extras/README/mario_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions extras/README/pyboy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def rtc3test_file():

@pytest.fixture(scope="session")
def git_tetris_ai():
if os.path.isfile("README/7.gif") or platform.system() == "Windows":
if os.path.isfile("extras/README/7.gif") or platform.system() == "Windows":
return None

import venv
Expand All @@ -261,7 +261,7 @@ def git_tetris_ai():

@pytest.fixture(scope="session")
def git_pyboy_rl():
if os.path.isfile("README/6.gif") or platform.system() == "Windows":
if os.path.isfile("extras/README/6.gif") or platform.system() == "Windows":
return None

import venv
Expand Down
3 changes: 2 additions & 1 deletion tests/test_acid_cgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

import PIL

from pyboy import PyBoy

OVERWRITE_PNGS = False
Expand All @@ -22,7 +23,7 @@ def test_cgb_acid(cgb_acid_file):
for _ in range(25):
pyboy.tick()

png_path = Path(f"test_results/{os.path.basename(cgb_acid_file)}.png")
png_path = Path(f"tests/test_results/{os.path.basename(cgb_acid_file)}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_acid_dmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import PIL
import pytest

from pyboy import PyBoy

OVERWRITE_PNGS = False
Expand All @@ -23,7 +24,7 @@ def test_dmg_acid(cgb, dmg_acid_file):
for _ in range(25):
pyboy.tick()

png_path = Path(f"test_results/{'cgb' if cgb else 'dmg'}_{os.path.basename(dmg_acid_file)}.png")
png_path = Path(f"tests/test_results/{'cgb' if cgb else 'dmg'}_{os.path.basename(dmg_acid_file)}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import PIL
import pytest

from pyboy import PyBoy, WindowEvent
from pyboy import __main__ as main
from pyboy.botsupport.tile import Tile
Expand Down Expand Up @@ -204,7 +205,7 @@ def test_all_modes(cgb, _bootrom, frames, rom, any_rom_cgb, boot_cgb_rom):
pyboy.tick()

rom_name = "cgbrom" if rom == any_rom_cgb else "dmgrom"
png_path = Path(f"test_results/all_modes/{rom_name}_{cgb}_{os.path.basename(str(_bootrom))}.png")
png_path = Path(f"tests/test_results/all_modes/{rom_name}_{cgb}_{os.path.basename(str(_bootrom))}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_blargg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from pathlib import Path

import pytest

from pyboy import PyBoy

OVERWRITE_JSON = False

blargg_json = "test_results/blargg.json"
blargg_json = "tests/test_results/blargg.json"


def run_rom(rom):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_magen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

import PIL

from pyboy import PyBoy

OVERWRITE_PNGS = False
Expand All @@ -22,7 +23,7 @@ def test_magen_test(magen_test_file):
for _ in range(25):
pyboy.tick()

png_path = Path(f"test_results/{os.path.basename(magen_test_file)}.png")
png_path = Path(f"tests/test_results/{os.path.basename(magen_test_file)}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_mario_rl.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@


@pytest.mark.skipif(
os.path.isfile("README/6.gif") or platform.system() == "Windows", reason="This test takes too long for regular use"
os.path.isfile("extras/README/6.gif") or platform.system() == "Windows",
reason="This test takes too long for regular use"
)
def test_mario_rl(git_pyboy_rl, supermarioland_rom):
script_py = "record_gif.py"
Expand All @@ -196,4 +197,4 @@ def test_mario_rl(git_pyboy_rl, supermarioland_rom):
assert os.system(
f'cd {git_pyboy_rl} && . {Path(".venv") / "bin" / "activate"} && python {script_py} {root_path / supermarioland_rom} Super_Mario_Land'
) == 0
assert os.system(f'mv {Path(git_pyboy_rl) / "recordings" / "SUPER*"} {Path("README/6.gif")}') == 0
assert os.system(f'mv {Path(git_pyboy_rl) / "recordings" / "SUPER*"} {Path("extras/README/6.gif")}') == 0
3 changes: 2 additions & 1 deletion tests/test_mooneye.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import PIL
import pytest

from pyboy import PyBoy

if platform.python_implementation() == "PyPy":
Expand Down Expand Up @@ -171,7 +172,7 @@ def test_mooneye(clean, rom, mooneye_dir, default_rom):
for _ in range(180 if "div_write" in rom else 40):
pyboy.tick()

png_path = Path(f"test_results/mooneye/{rom}.png")
png_path = Path(f"tests/test_results/mooneye/{rom}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import numpy as np
import pytest

from pyboy import PyBoy, WindowEvent, utils

event_filter = [
Expand Down Expand Up @@ -174,7 +175,7 @@ def test_pokemon_gif1(pokemon_gold_rom, boot_rom):
pokemon_gold_rom,
"tests/replays/pokemon_gold_gif.replay",
record_gif=(1, 2714),
gif_destination="README/1.gif",
gif_destination="extras/README/1.gif",
bootrom_file=boot_rom,
)

Expand All @@ -184,7 +185,7 @@ def test_pokemon_gif2(pokemon_blue_rom, boot_rom):
pokemon_blue_rom,
"tests/replays/pokemon_blue_gif2.replay",
record_gif=(0, 180),
gif_destination="README/2.gif",
gif_destination="extras/README/2.gif",
bootrom_file=boot_rom,
)

Expand All @@ -210,7 +211,7 @@ def test_kirby(kirby_rom, boot_rom):
kirby_rom,
"tests/replays/kirby_gif.replay",
record_gif=(0, 360),
gif_destination="README/4.gif",
gif_destination="extras/README/4.gif",
bootrom_file=boot_rom,
)

Expand All @@ -220,7 +221,7 @@ def test_rewind(supermarioland_rom, boot_rom):
supermarioland_rom,
"tests/replays/supermarioland_rewind.replay",
record_gif=(130, 544),
gif_destination="README/5.gif",
gif_destination="extras/README/5.gif",
rewind=True,
bootrom_file=None,
)
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion tests/test_rtc3test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import PIL
import pytest

from pyboy import PyBoy, WindowEvent

OVERWRITE_PNGS = False
Expand Down Expand Up @@ -42,7 +43,7 @@ def test_rtc3test(subtest, rtc3test_file):
break
pyboy.tick()

png_path = Path(f"test_results/{rtc3test_file}_{subtest}.png")
png_path = Path(f"tests/test_results/{rtc3test_file}_{subtest}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_samesuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import numpy as np
import PIL
import pytest

from pyboy import PyBoy

if platform.python_implementation() == "PyPy":
Expand Down Expand Up @@ -147,7 +148,7 @@ def test_samesuite(clean, gb_type, rom, samesuite_dir, boot_cgb_rom, boot_rom, d
else:
break

png_path = Path(f"test_results/SameSuite/{rom}.png")
png_path = Path(f"tests/test_results/SameSuite/{rom}.png")
image = pyboy.botsupport_manager().screen().screen_image()
if OVERWRITE_PNGS:
png_path.parents[0].mkdir(parents=True, exist_ok=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_shonumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import PIL
import pytest

from pyboy import PyBoy


Expand All @@ -28,7 +29,7 @@ def test_shonumi(rom, shonumi_dir):
for _ in range(60 + 23 + 48):
pyboy.tick()

png_path = Path(f"test_results/GB Tests/{rom}.png")
png_path = Path(f"tests/test_results/GB Tests/{rom}.png")
png_path.parents[0].mkdir(parents=True, exist_ok=True)
image = pyboy.botsupport_manager().screen().screen_image()

Expand Down
5 changes: 3 additions & 2 deletions tests/test_tetris_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def eval_network(epoch, child_index, child_model, record_to):


@pytest.mark.skipif(
os.path.isfile("README/7.gif") or platform.system() == "Windows", reason="This test takes too long for regular use"
os.path.isfile("extras/README/7.gif") or platform.system() == "Windows",
reason="This test takes too long for regular use"
)
def test_tetris_ai(git_tetris_ai, tetris_rom):
script_py = "tetris_gif.py"
Expand All @@ -193,4 +194,4 @@ def test_tetris_ai(git_tetris_ai, tetris_rom):
assert os.system(f'rm -rf {Path(git_tetris_ai) / "recordings"}') == 0
assert os.system(f"cp {tetris_rom} {Path(git_tetris_ai) / 'tetris_1.1.gb'}") == 0
assert os.system(f'cd {git_tetris_ai} && . {Path(".venv") / "bin" / "activate"} && python {script_py}') == 0
assert os.system(f'mv {Path(git_tetris_ai) / "recordings" / "TETRIS*"} {Path("README/7.gif")}') == 0
assert os.system(f'mv {Path(git_tetris_ai) / "recordings" / "TETRIS*"} {Path("extras/README/7.gif")}') == 0

0 comments on commit e4b07a3

Please sign in to comment.