From 8e70ce3c268f0dce66f4eb3d2535988c6d6479a1 Mon Sep 17 00:00:00 2001 From: awkawb Date: Mon, 30 Sep 2024 13:01:41 -0400 Subject: [PATCH] Added pytest for testing, Added pytest and loguru packages to nix shell --- shell.nix | 26 ++++++++++++++++---------- tests/conftest.py | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 tests/conftest.py diff --git a/shell.nix b/shell.nix index da8263e..35e5625 100644 --- a/shell.nix +++ b/shell.nix @@ -3,17 +3,23 @@ with pkgs; pkgs.mkShell { - nativeBuildInputs = [ - inlyne # markdown viewer + nativeBuildInputs = [ + inlyne # markdown viewer - # Python development environment - (python3.withPackages(ps: with ps; [ - # For SDK configuration - python-dotenv + # Python development environment + (python3.withPackages(ps: with ps; [ + # For SDK configuration + python-dotenv - # HTTP client - requests - ])) - ]; + # Logging + loguru + + # HTTP client + requests + + # Testing + pytest + ])) + ]; } diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..1c67e5f --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,14 @@ +# Library imports +import pytest + +#### +# Global fixtures +#### + +# App client for testing +@pytest.fixture(scope='module') +def client(): + app = create_app(config_class='tests/testing_config.py') + with app.app_context(): + yield app +