From 76978808aca5f69d73be65556e19365eaa5c4ef4 Mon Sep 17 00:00:00 2001 From: Russ Garrett Date: Tue, 3 Dec 2024 18:11:26 +0000 Subject: [PATCH] Add initial very basic tests --- .github/workflows/test.yml | 2 +- pyproject.toml | 10 +++++++- tests/test_basic.py | 13 +++++++++++ uv.lock | 48 +++++++++++++++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 tests/test_basic.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df79c79..367eb44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,4 +21,4 @@ jobs: run: | uv run ruff check uv run mypy . - + uv run pytest diff --git a/pyproject.toml b/pyproject.toml index 58d087b..cdec348 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,4 +23,12 @@ dependencies = [ Homepage = "https://github.com/russss/polybot" [dependency-groups] -dev = ["mypy>=1.13.0", "ruff>=0.8.1", "types-requests>=2.32.0.20241016"] +dev = [ + "mypy>=1.13.0", + "ruff>=0.8.1", + "types-requests>=2.32.0.20241016", + "pytest>=8.3.4", +] + +[tool.pytest.ini_options] +pythonpath = ["."] diff --git a/tests/test_basic.py b/tests/test_basic.py new file mode 100644 index 0000000..ec26df8 --- /dev/null +++ b/tests/test_basic.py @@ -0,0 +1,13 @@ +from polybot import Bot + + +class BotTest(Bot): + def main(self): + pass + + +def test_init(): + # Very basic test to exercise the initialisation code + bot = BotTest("test_bot") + assert bot.name == "test_bot" + bot.run() diff --git a/uv.lock b/uv.lock index 772edc5..d9ead58 100644 --- a/uv.lock +++ b/uv.lock @@ -321,6 +321,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 }, ] +[[package]] +name = "iniconfig" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 }, +] + [[package]] name = "libipld" version = "3.0.0" @@ -465,6 +474,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/80/cab10959dc1faead58dc8384a781dfbf93cb4d33d50988f7a69f1b7c9bbe/oauthlib-3.2.2-py3-none-any.whl", hash = "sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca", size = 151688 }, ] +[[package]] +name = "packaging" +version = "24.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 }, +] + [[package]] name = "pillow" version = "11.0.0" @@ -528,9 +546,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/44/5c/089154029fcca7729ae142ac820057f74ca4b0b59617734276c31281af15/pillow-11.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7326a1787e3c7b0429659e0a944725e1b03eeaa10edd945a86dead1913383944", size = 2567664 }, ] +[[package]] +name = "pluggy" +version = "1.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, +] + [[package]] name = "polybot" -version = "1.4.0" +version = "0.9.0" source = { virtual = "." } dependencies = [ { name = "atproto" }, @@ -543,6 +570,7 @@ dependencies = [ [package.dev-dependencies] dev = [ { name = "mypy" }, + { name = "pytest" }, { name = "ruff" }, { name = "types-requests" }, ] @@ -559,6 +587,7 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ { name = "mypy", specifier = ">=1.13.0" }, + { name = "pytest", specifier = ">=8.3.4" }, { name = "ruff", specifier = ">=0.8.1" }, { name = "types-requests", specifier = ">=2.32.0.20241016" }, ] @@ -669,6 +698,23 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fd/ab/718d9a1c41bb8d3e0e04d15b68b8afc135f8fcf552705b62f226225065c7/pydantic_core-2.27.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:62ba45e21cf6571d7f716d903b5b7b6d2617e2d5d67c0923dc47b9d41369f840", size = 2002035 }, ] +[[package]] +name = "pytest" +version = "8.3.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "tomli", marker = "python_full_version < '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/05/35/30e0d83068951d90a01852cb1cef56e5d8a09d20c7f511634cc2f7e0372a/pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761", size = 1445919 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/11/92/76a1c94d3afee238333bc0a42b82935dd8f9cf8ce9e336ff87ee14d9e1cf/pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6", size = 343083 }, +] + [[package]] name = "python-dateutil" version = "2.9.0.post0"