From a43014721afbd6939d6ad4b07c2e1060b74ee4b5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 16:58:02 +0000 Subject: [PATCH] Add basic tests to fix pytest exit code 5 CI failure Co-authored-by: Stalin-143 <161853795+Stalin-143@users.noreply.github.com> --- tests/__init__.py | 1 + tests/test_basic.py | 48 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_basic.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..6f042e1 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +# Test package for keylogger-educational diff --git a/tests/test_basic.py b/tests/test_basic.py new file mode 100644 index 0000000..d9e1861 --- /dev/null +++ b/tests/test_basic.py @@ -0,0 +1,48 @@ +""" +Basic tests for the keylogger-educational project. +These tests verify the basic project structure and configuration. +""" + +import os +import pytest + + +@pytest.fixture +def project_root(): + """Return the project root directory path.""" + return os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +def test_project_structure(project_root): + """Test that the project has expected structure.""" + # Check essential files exist + assert os.path.exists(os.path.join(project_root, 'pyproject.toml')) + assert os.path.exists(os.path.join(project_root, 'README.md')) + assert os.path.exists(os.path.join(project_root, 'src')) + + +def test_src_package_structure(project_root): + """Test that the src package has expected files.""" + src_dir = os.path.join(project_root, 'src') + + assert os.path.exists(os.path.join(src_dir, '__init__.py')) + assert os.path.exists(os.path.join(src_dir, 'keylogger.py')) + assert os.path.exists(os.path.join(src_dir, 'server.py')) + + +def test_config_directory_exists(project_root): + """Test that the config directory exists.""" + assert os.path.exists(os.path.join(project_root, 'config')) + + +def test_version_file_exists(project_root): + """Test that VERSION file exists and contains valid version.""" + version_file = os.path.join(project_root, 'VERSION') + + assert os.path.exists(version_file) + + with open(version_file, 'r') as f: + version = f.read().strip() + + # Check version is not empty + assert len(version) > 0