From 5dd106357866ca1cb265ac0b0e9d72b9d3302e16 Mon Sep 17 00:00:00 2001 From: Webb Scales Date: Tue, 29 Aug 2023 17:39:37 -0400 Subject: [PATCH] Relocate everything to make packaging work --- .github/workflows/ci.yml | 7 +++---- setup.cfg | 8 ++++---- {relay => src/relay}/__init__.py | 0 {relay => src/relay}/relay.py | 0 {relay => src}/requirements.txt | 0 {relay/tests => tests}/requirements.txt | 0 {relay/tests => tests}/test_relay.py | 5 +---- 7 files changed, 8 insertions(+), 12 deletions(-) rename {relay => src/relay}/__init__.py (100%) rename {relay => src/relay}/relay.py (100%) rename {relay => src}/requirements.txt (100%) rename {relay/tests => tests}/requirements.txt (100%) rename {relay/tests => tests}/test_relay.py (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6653aba..10192a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,8 @@ jobs: python-version: '3.x' - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install -r relay/requirements.txt - pip install -r relay/tests/requirements.txt + python -m pip install --upgrade pip setuptools wheel + pip install -r src/requirements.txt -r tests/requirements.txt . - name: Run Black run: black --check . - name: Run Flake8 @@ -32,7 +31,7 @@ jobs: - name: Run isort run: isort --check . - name: Run tests and collect coverage - run: pytest --junitxml=junit/test-results.xml --cov=relay --cov-report=xml --cov-report=html + run: pytest --junitxml=junit/test-results.xml --cov=relay --cov=tests --cov-report=xml --cov-report=html - name: Upload pytest test results uses: actions/upload-artifact@v3 with: diff --git a/setup.cfg b/setup.cfg index f5441a9..840cb10 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,14 +16,14 @@ zip_safe = False include_package_data = True packages = find: package_dir = - =relay + =src [options.packages.find] -where = relay +where = src [entry_points] console_scripts = - relay = relay:main + relay = relay.relay:main [tools:pytest] -testpaths = relay/tests +testpaths = tests diff --git a/relay/__init__.py b/src/relay/__init__.py similarity index 100% rename from relay/__init__.py rename to src/relay/__init__.py diff --git a/relay/relay.py b/src/relay/relay.py similarity index 100% rename from relay/relay.py rename to src/relay/relay.py diff --git a/relay/requirements.txt b/src/requirements.txt similarity index 100% rename from relay/requirements.txt rename to src/requirements.txt diff --git a/relay/tests/requirements.txt b/tests/requirements.txt similarity index 100% rename from relay/tests/requirements.txt rename to tests/requirements.txt diff --git a/relay/tests/test_relay.py b/tests/test_relay.py similarity index 99% rename from relay/tests/test_relay.py rename to tests/test_relay.py index f8ea412..0ebe9d6 100644 --- a/relay/tests/test_relay.py +++ b/tests/test_relay.py @@ -7,7 +7,6 @@ import shutil import subprocess from subprocess import CompletedProcess -import sys from typing import Any, Callable, IO, NamedTuple, Optional, Union from _pytest.monkeypatch import MonkeyPatch @@ -16,9 +15,7 @@ import humanize import pytest -# This file is in a subdirectory, so add the CUT's location to the path -sys.path.append(str(Path(__file__).resolve().parent.parent.parent)) -from relay import relay # noqa E402 +from relay import relay def mock_app_stub(