From 3969abee09aba4a17b814d58a7996223e649ed0d Mon Sep 17 00:00:00 2001 From: juztamau5 Date: Sun, 10 Mar 2024 10:13:58 -0700 Subject: [PATCH] fixup! Import example learning agents --- .github/workflows/python.yml | 14 ++++-- src/learning/poetry.lock | 64 +++++++++++++++++++++++++- src/learning/pyproject.toml | 1 + src/learning/test/test_random_agent.py | 16 +++++++ 4 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 src/learning/test/test_random_agent.py diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index f1eb719cb..0fa3a63ea 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -40,11 +40,6 @@ jobs: path: openai key: ${{ runner.os }}-cache-openai-${{ hashFiles('openai/**') }} - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install OpenAI dependencies if: steps.cache-openai.outputs.cache-hit != 'true' run: | @@ -62,6 +57,11 @@ jobs: cmake . make -j + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry run: | curl -sSL https://install.python-poetry.org | python3 - @@ -89,3 +89,7 @@ jobs: - name: Type check with mypy run: | poetry run mypy . + + - name: Run test cases + run: | + poetry run pytest diff --git a/src/learning/poetry.lock b/src/learning/poetry.lock index 9822af992..fe7d7821c 100644 --- a/src/learning/poetry.lock +++ b/src/learning/poetry.lock @@ -82,6 +82,20 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "exceptiongroup" +version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + [[package]] name = "farama-notifications" version = "0.0.4" @@ -156,6 +170,17 @@ other = ["lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "opencv-pyt testing = ["pytest (==7.1.3)", "scipy (>=1.7.3)"] toy-text = ["pygame (>=2.1.3)", "pygame (>=2.1.3)"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "isort" version = "5.13.2" @@ -321,6 +346,21 @@ files = [ docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] +[[package]] +name = "pluggy" +version = "1.4.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "pycodestyle" version = "2.11.1" @@ -343,6 +383,28 @@ files = [ {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, ] +[[package]] +name = "pytest" +version = "8.1.1" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest-8.1.1-py3-none-any.whl", hash = "sha256:2a8386cfc11fa9d2c50ee7b2a57e7d898ef90470a7a34c4b949ff59662bb78b7"}, + {file = "pytest-8.1.1.tar.gz", hash = "sha256:ac978141a75948948817d360297b7aae0fcb9d6ff6bc9ec6d514b85d5a65c044"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=1.4,<2.0" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "tomli" version = "2.0.1" @@ -368,4 +430,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "0b84664cc5b8b2739b9f7597bc96fbba953627512ed4f81ce932a980cd5be682" +content-hash = "c551333745c04f8f4d5d28b211f41e2c2d1eda5bdbd6664306dd4e2a8984d964" diff --git a/src/learning/pyproject.toml b/src/learning/pyproject.toml index 9ee0e7ae7..3e079effa 100644 --- a/src/learning/pyproject.toml +++ b/src/learning/pyproject.toml @@ -27,6 +27,7 @@ flake8 = "^7.0.0" flake8-pyproject = "^1.2.3" isort = "^5.13.2" mypy = "^1.9.0" +pytest = "^8.1.1" [build-system] requires = ["poetry-core"] diff --git a/src/learning/test/test_random_agent.py b/src/learning/test/test_random_agent.py new file mode 100644 index 000000000..ac06f61d2 --- /dev/null +++ b/src/learning/test/test_random_agent.py @@ -0,0 +1,16 @@ +################################################################################ +# +# Copyright (C) 2024 retro.ai +# This file is part of retro3 - https://github.com/retroai/retro3 +# +# SPDX-License-Identifier: AGPL-3.0-or-later +# See the file LICENSE.txt for more information. +# +################################################################################ + +#import retroai.retro_env + + +def test_example(): + # Replace with an actual test + assert True