diff --git a/.dockerignore b/.dockerignore
index cef48cf6..6df235b6 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -5,3 +5,4 @@
!/main.py
!/requirements.txt
!/src
+!/pyproject.toml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 87ba2e92..ae876ef8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## Unreleased
+- Project prepared to be installed with `pip install`, so it can be reused in
+ the repository https://github.com/canonical/gatekeeper-repo-test
+
## [v0.9.0] - 2024-04-04
### Added
diff --git a/Dockerfile b/Dockerfile
index eb678b66..2080f03a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,10 +8,9 @@ RUN apt-get update && \
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
-COPY requirements.txt /usr/src/app
-RUN pip install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
+RUN pip install --no-cache-dir /usr/src/app
ENV PYTHONPATH /usr/src/app
CMD ["/usr/src/app/main.py"]
diff --git a/generate-src-docs.sh b/generate-src-docs.sh
index e61c1e3d..b93f0074 100644
--- a/generate-src-docs.sh
+++ b/generate-src-docs.sh
@@ -4,4 +4,4 @@
# See LICENSE file for licensing details.
rm -rf src-docs
-lazydocs --no-watermark --output-path src-docs src/*.py
+lazydocs --no-watermark --output-path src-docs src/gatekeeper/*.py
diff --git a/main.py b/main.py
index 7e8088a8..e3162b7a 100755
--- a/main.py
+++ b/main.py
@@ -16,10 +16,17 @@
from functools import partial
from pathlib import Path
-from src import GETTING_STARTED, exceptions, pre_flight_checks, run_migrate, run_reconcile, types_
-from src.clients import get_clients
-from src.constants import DEFAULT_BRANCH
-from src.types_ import ActionResult, PullRequestAction
+from gatekeeper import (
+ GETTING_STARTED,
+ exceptions,
+ pre_flight_checks,
+ run_migrate,
+ run_reconcile,
+ types_,
+)
+from gatekeeper.clients import get_clients
+from gatekeeper.constants import DEFAULT_BRANCH
+from gatekeeper.types_ import ActionResult, PullRequestAction
GITHUB_HEAD_REF_ENV_NAME = "GITHUB_HEAD_REF"
GITHUB_OUTPUT_ENV_NAME = "GITHUB_OUTPUT"
diff --git a/pyproject.toml b/pyproject.toml
index 9729678f..fd852d9a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,14 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
+[project]
+name = "discourse-gatekeeper"
+version = "0.9.0"
+dynamic = ["dependencies"]
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt"]}
+
[tool.bandit]
exclude_dirs = ["/venv/", ".tox"]
[tool.bandit.assert_used]
diff --git a/src-docs/__init__.py.md b/src-docs/__init__.py.md
index 1c2b6a36..07ebf0be 100644
--- a/src-docs/__init__.py.md
+++ b/src-docs/__init__.py.md
@@ -1,6 +1,6 @@
-
+
# module `__init__.py`
Library for uploading docs to charmhub.
@@ -15,7 +15,7 @@ Library for uploading docs to charmhub.
---
-
+
## function `run_reconcile`
@@ -50,7 +50,7 @@ Upload the documentation to charmhub.
---
-
+
## function `run_migrate`
@@ -75,7 +75,7 @@ Migrate existing docs from charmhub to local repository.
---
-
+
## function `pre_flight_checks`
diff --git a/src-docs/action.py.md b/src-docs/action.py.md
index 6444b189..4ac15b80 100644
--- a/src-docs/action.py.md
+++ b/src-docs/action.py.md
@@ -1,6 +1,6 @@
-
+
# module `action.py`
Module for taking the required actions to match the server state with the local state.
@@ -15,7 +15,7 @@ Module for taking the required actions to match the server state with the local
---
-
+
## function `run_all`
diff --git a/src-docs/check.py.md b/src-docs/check.py.md
index e1b3babf..0eb0611e 100644
--- a/src-docs/check.py.md
+++ b/src-docs/check.py.md
@@ -1,6 +1,6 @@
-
+
# module `check.py`
Module for running checks.
@@ -11,7 +11,7 @@ Module for running checks.
---
-
+
## function `get_path_with_diffs`
@@ -37,7 +37,7 @@ Generate the paths that have either local or server content changes.
---
-
+
## function `conflicts`
@@ -67,7 +67,7 @@ The second type of conflict is a logical conflict which arises out of that there
---
-
+
## function `external_refs`
diff --git a/src-docs/clients.py.md b/src-docs/clients.py.md
index 74b77615..7152ab5d 100644
--- a/src-docs/clients.py.md
+++ b/src-docs/clients.py.md
@@ -1,6 +1,6 @@
-
+
# module `clients.py`
Module for Client class.
@@ -8,7 +8,7 @@ Module for Client class.
---
-
+
## function `get_clients`
diff --git a/src-docs/commit.py.md b/src-docs/commit.py.md
index b6f93157..dfc3ef44 100644
--- a/src-docs/commit.py.md
+++ b/src-docs/commit.py.md
@@ -1,6 +1,6 @@
-
+
# module `commit.py`
Module for handling interactions with git commit.
@@ -8,7 +8,7 @@ Module for handling interactions with git commit.
---
-
+
## function `parse_git_show`
diff --git a/src-docs/constants.py.md b/src-docs/constants.py.md
index 3c950b6b..162d0652 100644
--- a/src-docs/constants.py.md
+++ b/src-docs/constants.py.md
@@ -1,6 +1,6 @@
-
+
# module `constants.py`
Shared constants.
diff --git a/src-docs/content.py.md b/src-docs/content.py.md
index 9e0b65b1..d37e8961 100644
--- a/src-docs/content.py.md
+++ b/src-docs/content.py.md
@@ -1,6 +1,6 @@
-
+
# module `content.py`
Module for checking conflicts using 3-way merge and create content based on a 3 way merge.
@@ -8,7 +8,7 @@ Module for checking conflicts using 3-way merge and create content based on a 3
---
-
+
## function `conflicts`
@@ -34,7 +34,7 @@ Check for merge conflicts based on the git merge algorithm.
---
-
+
## function `merge`
@@ -66,7 +66,7 @@ Create the merged content based on the git merge algorithm.
---
-
+
## function `diff`
diff --git a/src-docs/discourse.py.md b/src-docs/discourse.py.md
index cfd63c2a..ab4b0e92 100644
--- a/src-docs/discourse.py.md
+++ b/src-docs/discourse.py.md
@@ -1,6 +1,6 @@
-
+
# module `discourse.py`
Interface for Discourse interactions.
@@ -8,7 +8,7 @@ Interface for Discourse interactions.
---
-
+
## function `create_discourse`
@@ -50,7 +50,7 @@ Interact with a discourse server.
Attrs: host: The host of the discourse server.
-
+
### function `__init__`
@@ -80,7 +80,7 @@ The HTTP protocol and hostname for discourse (e.g., https://discourse).
---
-
+
### function `absolute_url`
@@ -103,7 +103,7 @@ Get the URL including base path for a topic.
---
-
+
### function `check_topic_read_permission`
@@ -128,7 +128,7 @@ Uses whether retrieve topic succeeds as indication whether the read permission i
---
-
+
### function `check_topic_write_permission`
@@ -151,7 +151,7 @@ Check whether the credentials have write permission on a topic.
---
-
+
### function `create_topic`
@@ -181,7 +181,7 @@ Create a new topic.
---
-
+
### function `delete_topic`
@@ -210,7 +210,7 @@ Delete a topic.
---
-
+
### function `retrieve_topic`
@@ -239,7 +239,7 @@ Retrieve the topic content.
---
-
+
### function `topic_url_valid`
@@ -264,7 +264,7 @@ Validations: 1. The URL must start with the base path configured during constru
---
-
+
### function `update_topic`
diff --git a/src-docs/docs_directory.py.md b/src-docs/docs_directory.py.md
index 77ca760c..24b48a51 100644
--- a/src-docs/docs_directory.py.md
+++ b/src-docs/docs_directory.py.md
@@ -1,6 +1,6 @@
-
+
# module `docs_directory.py`
Class for reading the docs directory.
@@ -11,7 +11,7 @@ Class for reading the docs directory.
---
-
+
## function `calculate_table_path`
@@ -35,7 +35,7 @@ Calculate the table path of a path.
---
-
+
## function `read`
@@ -61,7 +61,7 @@ Algorithm: 1. Get a list of all sub directories and .md files in the docs fold
---
-
+
## function `has_docs_directory`
diff --git a/src-docs/download.py.md b/src-docs/download.py.md
index 057eb2f7..22734514 100644
--- a/src-docs/download.py.md
+++ b/src-docs/download.py.md
@@ -1,6 +1,6 @@
-
+
# module `download.py`
Library for downloading docs folder from charmhub.
@@ -8,7 +8,7 @@ Library for downloading docs folder from charmhub.
---
-
+
## function `recreate_docs`
diff --git a/src-docs/exceptions.py.md b/src-docs/exceptions.py.md
index 641f7a51..38c61797 100644
--- a/src-docs/exceptions.py.md
+++ b/src-docs/exceptions.py.md
@@ -1,6 +1,6 @@
-
+
# module `exceptions.py`
Exceptions for uploading docs to charmhub.
diff --git a/src-docs/index.py.md b/src-docs/index.py.md
index 96ddb6fd..54059347 100644
--- a/src-docs/index.py.md
+++ b/src-docs/index.py.md
@@ -1,6 +1,6 @@
-
+
# module `index.py`
Execute the uploading of documentation.
@@ -15,7 +15,7 @@ Execute the uploading of documentation.
---
-
+
## function `get`
@@ -47,7 +47,7 @@ Retrieve the local and server index information.
---
-
+
## function `contents_from_page`
@@ -71,7 +71,7 @@ Get index file contents from server page.
---
-
+
## function `get_content_for_server`
@@ -95,7 +95,7 @@ Get the contents from the index file that should be passed to the server.
---
-
+
## function `classify_item_reference`
@@ -123,7 +123,7 @@ Classify the type of a reference.
---
-
+
## function `get_contents`
diff --git a/src-docs/metadata.py.md b/src-docs/metadata.py.md
index 4bf6d711..65d0958a 100644
--- a/src-docs/metadata.py.md
+++ b/src-docs/metadata.py.md
@@ -1,6 +1,6 @@
-
+
# module `metadata.py`
Module for parsing metadata.yaml file.
@@ -17,7 +17,7 @@ Module for parsing metadata.yaml file.
---
-
+
## function `get`
diff --git a/src-docs/migration.py.md b/src-docs/migration.py.md
index 3784ad2f..e6c78211 100644
--- a/src-docs/migration.py.md
+++ b/src-docs/migration.py.md
@@ -1,6 +1,6 @@
-
+
# module `migration.py`
Module for migrating remote documentation into local git repository.
@@ -12,7 +12,7 @@ Module for migrating remote documentation into local git repository.
---
-
+
## function `make_parent`
@@ -37,7 +37,7 @@ Construct path leading to document to be created.
---
-
+
## function `run`
diff --git a/src-docs/navigation_table.py.md b/src-docs/navigation_table.py.md
index 1d2956e4..3f752b6d 100644
--- a/src-docs/navigation_table.py.md
+++ b/src-docs/navigation_table.py.md
@@ -1,6 +1,6 @@
-
+
# module `navigation_table.py`
Module for parsing and rendering a navigation table.
@@ -8,7 +8,7 @@ Module for parsing and rendering a navigation table.
---
-
+
## function `from_page`
@@ -35,7 +35,7 @@ Algorithm: 1. Extract the table based on a regular expression looking for a 3
---
-
+
## function `generate_table_row`
diff --git a/src-docs/reconcile.py.md b/src-docs/reconcile.py.md
index 1150018f..b4bf0aae 100644
--- a/src-docs/reconcile.py.md
+++ b/src-docs/reconcile.py.md
@@ -1,6 +1,6 @@
-
+
# module `reconcile.py`
Module for calculating required changes based on docs directory and navigation table.
@@ -12,7 +12,7 @@ Module for calculating required changes based on docs directory and navigation t
---
-
+
## function `is_same_content`
@@ -40,7 +40,7 @@ Check if the content on Discourse and Github matches.
---
-
+
## function `run`
@@ -78,7 +78,7 @@ Items only in table_rows won't have their order preserved. Those items are the i
---
-
+
## function `index_page`
diff --git a/src-docs/repository.py.md b/src-docs/repository.py.md
index 92e31170..650c239a 100644
--- a/src-docs/repository.py.md
+++ b/src-docs/repository.py.md
@@ -1,6 +1,6 @@
-
+
# module `repository.py`
Module for handling interactions with git repository.
@@ -25,7 +25,7 @@ Module for handling interactions with git repository.
---
-
+
## function `create_repository_client`
@@ -66,7 +66,7 @@ Wrapper for git/git-server related functionalities.
Attrs: base_path: The root directory of the repository. base_charm_path: The directory of the repository where the charm is. docs_path: The directory of the repository where the documentation is. metadata: Metadata object of the charm has_docs_directory: whether the repository has a docs directory current_branch: current git branch used in the repository current_commit: current commit checkout in the repository branches: list of all branches
-
+
### function `__init__`
@@ -145,7 +145,7 @@ Return the Metadata object of the charm.
---
-
+
### function `create_branch`
@@ -179,7 +179,7 @@ repository.create_branch(branch_name).switch(branch_name)
---
-
+
### function `create_pull_request`
@@ -208,7 +208,7 @@ Create pull request for changes in given repository path.
---
-
+
### function `get_file_content_from_tag`
@@ -240,7 +240,7 @@ Get the content of a file for a specific tag.
---
-
+
### function `get_pull_request`
@@ -269,7 +269,7 @@ Return open pull request matching the provided branch name.
---
-
+
### function `get_summary`
@@ -292,7 +292,7 @@ Return a summary of the differences against the most recent commit.
---
-
+
### function `is_commit_in_branch`
@@ -322,7 +322,7 @@ Check if commit exists in a given branch.
---
-
+
### function `is_dirty`
@@ -345,7 +345,7 @@ Check if repository path has any changes including new files.
---
-
+
### function `is_same_commit`
@@ -369,7 +369,7 @@ Return whether tag and commit coincides.
---
-
+
### function `pull`
@@ -387,7 +387,7 @@ Pull content from remote for the provided branch.
---
-
+
### function `switch`
@@ -410,7 +410,7 @@ Switch branch for the repository.
---
-
+
### function `tag_commit`
@@ -435,7 +435,7 @@ Tag a commit, if the tag already exists, it is deleted first.
---
-
+
### function `tag_exists`
@@ -458,7 +458,7 @@ Check if a given tag exists.
---
-
+
### function `update_branch`
@@ -495,7 +495,7 @@ Update branch with a new commit.
---
-
+
### function `update_pull_request`
@@ -549,7 +549,7 @@ Attrs: is_dirty: boolean indicated whether there is any delta new: list of fil
---
-
+
### classmethod `from_raw_diff`
diff --git a/src-docs/sort.py.md b/src-docs/sort.py.md
index 9d8530fc..65e7e6a2 100644
--- a/src-docs/sort.py.md
+++ b/src-docs/sort.py.md
@@ -1,6 +1,6 @@
-
+
# module `sort.py`
Sort items for publishing.
@@ -8,7 +8,7 @@ Sort items for publishing.
---
-
+
## function `using_contents_index`
diff --git a/src-docs/types_.py.md b/src-docs/types_.py.md
index 51d1051e..a4c6a180 100644
--- a/src-docs/types_.py.md
+++ b/src-docs/types_.py.md
@@ -1,6 +1,6 @@
-
+
# module `types_.py`
Types for uploading docs to charmhub.
@@ -371,7 +371,7 @@ Whether the row is a group of pages.
---
-
+
### function `is_external`
@@ -394,7 +394,7 @@ Whether the row is an external reference.
---
-
+
### function `to_markdown`
diff --git a/src/__init__.py b/src/gatekeeper/__init__.py
similarity index 94%
rename from src/__init__.py
rename to src/gatekeeper/__init__.py
index 30405066..95360a80 100644
--- a/src/__init__.py
+++ b/src/gatekeeper/__init__.py
@@ -6,17 +6,17 @@
from collections.abc import Iterable, Iterator
from itertools import tee
-from src import action, check, docs_directory
-from src import index as index_module
-from src import navigation_table, reconcile
-from src import sort as sort_module
-from src.action import DRY_RUN_NAVLINK_LINK, FAIL_NAVLINK_LINK
-from src.clients import Clients
-from src.constants import DOCUMENTATION_TAG
-from src.download import recreate_docs
-from src.exceptions import InputError, TaggingNotAllowedError
-from src.repository import DEFAULT_BRANCH_NAME
-from src.types_ import (
+from gatekeeper import action, check, docs_directory
+from gatekeeper import index as index_module
+from gatekeeper import navigation_table, reconcile
+from gatekeeper import sort as sort_module
+from gatekeeper.action import DRY_RUN_NAVLINK_LINK, FAIL_NAVLINK_LINK
+from gatekeeper.clients import Clients
+from gatekeeper.constants import DOCUMENTATION_TAG
+from gatekeeper.download import recreate_docs
+from gatekeeper.exceptions import InputError, TaggingNotAllowedError
+from gatekeeper.repository import DEFAULT_BRANCH_NAME
+from gatekeeper.types_ import (
ActionResult,
AnyAction,
Index,
diff --git a/src/action.py b/src/gatekeeper/action.py
similarity index 99%
rename from src/action.py
rename to src/gatekeeper/action.py
index 1702da92..85e1d403 100644
--- a/src/action.py
+++ b/src/gatekeeper/action.py
@@ -7,8 +7,8 @@
import typing
from enum import Enum
-from src import content, exceptions, reconcile, types_
-from src.discourse import Discourse
+from gatekeeper import content, exceptions, reconcile, types_
+from gatekeeper.discourse import Discourse
DRY_RUN_NAVLINK_LINK = ""
DRY_RUN_REASON = "dry run"
diff --git a/src/check.py b/src/gatekeeper/check.py
similarity index 98%
rename from src/check.py
rename to src/gatekeeper/check.py
index f5e1a208..07adcd12 100644
--- a/src/check.py
+++ b/src/gatekeeper/check.py
@@ -10,9 +10,9 @@
import requests
-from src import content
-from src.constants import DOCUMENTATION_TAG
-from src.types_ import (
+from gatekeeper import content
+from gatekeeper.constants import DOCUMENTATION_TAG
+from gatekeeper.types_ import (
AnyAction,
IndexContentsListItem,
UpdateAction,
diff --git a/src/clients.py b/src/gatekeeper/clients.py
similarity index 84%
rename from src/clients.py
rename to src/gatekeeper/clients.py
index c9d732a3..5e843c60 100644
--- a/src/clients.py
+++ b/src/gatekeeper/clients.py
@@ -6,10 +6,10 @@
import typing
from pathlib import Path
-from src.discourse import Discourse, create_discourse
-from src.repository import Client as RepositoryClient
-from src.repository import create_repository_client
-from src.types_ import UserInputs
+from gatekeeper.discourse import Discourse, create_discourse
+from gatekeeper.repository import Client as RepositoryClient
+from gatekeeper.repository import create_repository_client
+from gatekeeper.types_ import UserInputs
class Clients(typing.NamedTuple):
diff --git a/src/commit.py b/src/gatekeeper/commit.py
similarity index 100%
rename from src/commit.py
rename to src/gatekeeper/commit.py
diff --git a/src/constants.py b/src/gatekeeper/constants.py
similarity index 100%
rename from src/constants.py
rename to src/gatekeeper/constants.py
diff --git a/src/content.py b/src/gatekeeper/content.py
similarity index 98%
rename from src/content.py
rename to src/gatekeeper/content.py
index 9ffea9a5..e50474a4 100644
--- a/src/content.py
+++ b/src/gatekeeper/content.py
@@ -10,7 +10,7 @@
from git.exc import GitCommandError
from git.repo import Repo
-from src.exceptions import ContentError
+from gatekeeper.exceptions import ContentError
_BASE_BRANCH = "base"
_THEIR_BRANCH = "theirs"
diff --git a/src/discourse.py b/src/gatekeeper/discourse.py
similarity index 99%
rename from src/discourse.py
rename to src/gatekeeper/discourse.py
index 8af01af4..406e4102 100644
--- a/src/discourse.py
+++ b/src/gatekeeper/discourse.py
@@ -12,7 +12,7 @@
from requests.adapters import HTTPAdapter
from urllib3 import Retry
-from src.exceptions import DiscourseError, InputError
+from gatekeeper.exceptions import DiscourseError, InputError
_URL_PATH_PREFIX = "/t/"
_POST_SPLIT_LINE = "\n\n-------------------------\n\n"
diff --git a/src/docs_directory.py b/src/gatekeeper/docs_directory.py
similarity index 98%
rename from src/docs_directory.py
rename to src/gatekeeper/docs_directory.py
index 5e9230be..7c2df454 100644
--- a/src/docs_directory.py
+++ b/src/gatekeeper/docs_directory.py
@@ -8,8 +8,8 @@
from itertools import count
from pathlib import Path
-from src import types_
-from src.constants import DOC_FILE_EXTENSION
+from gatekeeper import types_
+from gatekeeper.constants import DOC_FILE_EXTENSION
def _get_directories_files(docs_path: Path) -> list[Path]:
diff --git a/src/download.py b/src/gatekeeper/download.py
similarity index 85%
rename from src/download.py
rename to src/gatekeeper/download.py
index f16d9809..8b31ce9c 100644
--- a/src/download.py
+++ b/src/gatekeeper/download.py
@@ -5,11 +5,11 @@
import shutil
-from src.clients import Clients
-from src.index import contents_from_page
-from src.index import get as get_index
-from src.migration import run as migrate_contents
-from src.navigation_table import from_page as navigation_table_from_page
+from gatekeeper.clients import Clients
+from gatekeeper.index import contents_from_page
+from gatekeeper.index import get as get_index
+from gatekeeper.migration import run as migrate_contents
+from gatekeeper.navigation_table import from_page as navigation_table_from_page
def _download_from_discourse(clients: Clients) -> None:
diff --git a/src/exceptions.py b/src/gatekeeper/exceptions.py
similarity index 100%
rename from src/exceptions.py
rename to src/gatekeeper/exceptions.py
diff --git a/src/index.py b/src/gatekeeper/index.py
similarity index 97%
rename from src/index.py
rename to src/gatekeeper/index.py
index 46a3eedf..5dbf1485 100644
--- a/src/index.py
+++ b/src/gatekeeper/index.py
@@ -10,10 +10,14 @@
from enum import Enum, auto
from pathlib import Path
-from src.constants import DOC_FILE_EXTENSION, DOCUMENTATION_INDEX_FILENAME, NAVIGATION_HEADING
-from src.discourse import Discourse
-from src.exceptions import DiscourseError, InputError, ServerError
-from src.types_ import Index, IndexContentsListItem, IndexFile, Metadata, Page
+from gatekeeper.constants import (
+ DOC_FILE_EXTENSION,
+ DOCUMENTATION_INDEX_FILENAME,
+ NAVIGATION_HEADING,
+)
+from gatekeeper.discourse import Discourse
+from gatekeeper.exceptions import DiscourseError, InputError, ServerError
+from gatekeeper.types_ import Index, IndexContentsListItem, IndexFile, Metadata, Page
CONTENTS_HEADER = "# contents"
CONTENTS_END_LINE_PREFIX = "#"
diff --git a/src/metadata.py b/src/gatekeeper/metadata.py
similarity index 98%
rename from src/metadata.py
rename to src/gatekeeper/metadata.py
index ec4de83d..a9817eb1 100644
--- a/src/metadata.py
+++ b/src/gatekeeper/metadata.py
@@ -7,8 +7,8 @@
import yaml
-from src import types_
-from src.exceptions import InputError
+from gatekeeper import types_
+from gatekeeper.exceptions import InputError
CHARMCRAFT_FILENAME = "charmcraft.yaml"
CHARMCRAFT_NAME_KEY = "name"
diff --git a/src/migration.py b/src/gatekeeper/migration.py
similarity index 99%
rename from src/migration.py
rename to src/gatekeeper/migration.py
index 185d8629..aa33c9b1 100644
--- a/src/migration.py
+++ b/src/gatekeeper/migration.py
@@ -8,8 +8,8 @@
import typing
from pathlib import Path
-from src import exceptions, types_
-from src.discourse import Discourse
+from gatekeeper import exceptions, types_
+from gatekeeper.discourse import Discourse
EMPTY_DIR_REASON = ""
GITKEEP_FILENAME = ".gitkeep"
diff --git a/src/navigation_table.py b/src/gatekeeper/navigation_table.py
similarity index 98%
rename from src/navigation_table.py
rename to src/gatekeeper/navigation_table.py
index 108254c4..797d5744 100644
--- a/src/navigation_table.py
+++ b/src/gatekeeper/navigation_table.py
@@ -7,9 +7,9 @@
import string
import typing
-from src import constants, types_
-from src.discourse import Discourse
-from src.exceptions import (
+from gatekeeper import constants, types_
+from gatekeeper.discourse import Discourse
+from gatekeeper.exceptions import (
DiscourseError,
NavigationTableParseError,
PagePermissionError,
diff --git a/src/reconcile.py b/src/gatekeeper/reconcile.py
similarity index 98%
rename from src/reconcile.py
rename to src/gatekeeper/reconcile.py
index 20e62258..e3469f7c 100644
--- a/src/reconcile.py
+++ b/src/gatekeeper/reconcile.py
@@ -7,12 +7,12 @@
import typing
from pathlib import Path
-from src import exceptions
-from src import index as index_module
-from src import types_
-from src.clients import Clients
-from src.constants import DOCUMENTATION_TAG, NAVIGATION_TABLE_START
-from src.discourse import Discourse
+from gatekeeper import exceptions
+from gatekeeper import index as index_module
+from gatekeeper import types_
+from gatekeeper.clients import Clients
+from gatekeeper.constants import DOCUMENTATION_TAG, NAVIGATION_TABLE_START
+from gatekeeper.discourse import Discourse
def _local_only(item_info: types_.PathInfo | types_.IndexContentsListItem) -> types_.CreateAction:
diff --git a/src/repository.py b/src/gatekeeper/repository.py
similarity index 99%
rename from src/repository.py
rename to src/gatekeeper/repository.py
index 96043b42..c97452ac 100644
--- a/src/repository.py
+++ b/src/gatekeeper/repository.py
@@ -23,17 +23,17 @@
from github.PullRequest import PullRequest
from github.Repository import Repository
-from src import commit as commit_module
-from src.constants import DOCUMENTATION_FOLDER_NAME
-from src.docs_directory import has_docs_directory
-from src.exceptions import (
+from gatekeeper import commit as commit_module
+from gatekeeper.constants import DOCUMENTATION_FOLDER_NAME
+from gatekeeper.docs_directory import has_docs_directory
+from gatekeeper.exceptions import (
InputError,
RepositoryClientError,
RepositoryFileNotFoundError,
RepositoryTagNotFoundError,
)
-from src.metadata import get as get_metadata
-from src.types_ import Metadata
+from gatekeeper.metadata import get as get_metadata
+from gatekeeper.types_ import Metadata
GITHUB_HOSTNAME = "github.com"
ORIGIN_NAME = "origin"
diff --git a/src/sort.py b/src/gatekeeper/sort.py
similarity index 99%
rename from src/sort.py
rename to src/gatekeeper/sort.py
index 56e33e86..4565491f 100644
--- a/src/sort.py
+++ b/src/gatekeeper/sort.py
@@ -9,7 +9,7 @@
from more_itertools import peekable, side_effect
-from src import index, types_
+from gatekeeper import index, types_
class _SortData(typing.NamedTuple):
diff --git a/src/types_.py b/src/gatekeeper/types_.py
similarity index 99%
rename from src/types_.py
rename to src/gatekeeper/types_.py
index d07decaa..8363faa4 100644
--- a/src/types_.py
+++ b/src/gatekeeper/types_.py
@@ -10,7 +10,7 @@
from pathlib import Path
from urllib.parse import urlparse
-from src import constants
+from gatekeeper import constants
Content = str
Url = str
diff --git a/tests/conftest.py b/tests/conftest.py
index c9067077..10e02a28 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -13,9 +13,9 @@
from github.Repository import Repository
from github.Requester import Requester
-import src
-from src import repository
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME, DOCUMENTATION_TAG
+import gatekeeper
+from gatekeeper import repository
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME, DOCUMENTATION_TAG
# This is a fake branch to be used in the remote repository to prevent conflicts when
# pushing main. Another option would be to use remote bare repository, but this would
@@ -169,4 +169,6 @@ def mock_create_repository_client(**_kwargs):
"""Mock create_repository_client patch function.""" # noqa: DCO020
return repository_client # noqa: DCO030
- monkeypatch.setattr(src.clients, "create_repository_client", mock_create_repository_client)
+ monkeypatch.setattr(
+ gatekeeper.clients, "create_repository_client", mock_create_repository_client
+ )
diff --git a/tests/factories.py b/tests/factories.py
index 63a902b6..6f4fc9f3 100644
--- a/tests/factories.py
+++ b/tests/factories.py
@@ -11,8 +11,8 @@
import factory
-from src import index, types_
-from src.constants import DEFAULT_BRANCH
+from gatekeeper import index, types_
+from gatekeeper.constants import DEFAULT_BRANCH
from . import types
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py
index 72e19e32..3058f967 100644
--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -20,7 +20,7 @@
from juju.unit import Unit
from pytest_operator.plugin import OpsTest
-from src.discourse import Discourse
+from gatekeeper.discourse import Discourse
from . import types
diff --git a/tests/integration/test___init__run_conflict.py b/tests/integration/test___init__run_conflict.py
index d979a95a..6985af51 100644
--- a/tests/integration/test___init__run_conflict.py
+++ b/tests/integration/test___init__run_conflict.py
@@ -19,9 +19,9 @@
import pytest
from github.ContentFile import ContentFile
-from src import Clients, constants, exceptions, metadata, repository, run_reconcile
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
-from src.discourse import Discourse
+from gatekeeper import Clients, constants, exceptions, metadata, repository, run_reconcile
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
+from gatekeeper.discourse import Discourse
from .. import factories
from ..unit.helpers import assert_substrings_in_string, create_metadata_yaml
diff --git a/tests/integration/test___init__run_migrate.py b/tests/integration/test___init__run_migrate.py
index ed31b5c9..09ebadb3 100644
--- a/tests/integration/test___init__run_migrate.py
+++ b/tests/integration/test___init__run_migrate.py
@@ -14,12 +14,12 @@
from git.repo import Repo
from github.PullRequest import PullRequest
-from src import Clients, constants, metadata, migration, run_migrate
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
-from src.discourse import Discourse
-from src.repository import DEFAULT_BRANCH_NAME
-from src.repository import Client as RepositoryClient
-from src.types_ import PullRequestAction
+from gatekeeper import Clients, constants, metadata, migration, run_migrate
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
+from gatekeeper.discourse import Discourse
+from gatekeeper.repository import DEFAULT_BRANCH_NAME
+from gatekeeper.repository import Client as RepositoryClient
+from gatekeeper.types_ import PullRequestAction
from .. import factories
from ..conftest import BASE_REMOTE_BRANCH
diff --git a/tests/integration/test___init__run_reconcile.py b/tests/integration/test___init__run_reconcile.py
index 4d33339d..a37c3798 100644
--- a/tests/integration/test___init__run_reconcile.py
+++ b/tests/integration/test___init__run_reconcile.py
@@ -17,10 +17,10 @@
import pytest
from github.ContentFile import ContentFile
-from src import Clients, constants, exceptions, metadata, run_reconcile
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
-from src.discourse import Discourse
-from src.repository import Client, Repo
+from gatekeeper import Clients, constants, exceptions, metadata, run_reconcile
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_TAG
+from gatekeeper.discourse import Discourse
+from gatekeeper.repository import Client, Repo
from .. import factories
from ..unit.helpers import assert_substrings_in_string, create_metadata_yaml
diff --git a/tests/integration/test_discourse.py b/tests/integration/test_discourse.py
index eb2f5140..08a82ce9 100644
--- a/tests/integration/test_discourse.py
+++ b/tests/integration/test_discourse.py
@@ -9,8 +9,8 @@
import pydiscourse
import pytest
-from src.discourse import Discourse
-from src.exceptions import DiscourseError
+from gatekeeper.discourse import Discourse
+from gatekeeper.exceptions import DiscourseError
from . import types
diff --git a/tests/unit/action/test_other_actions.py b/tests/unit/action/test_other_actions.py
index e44235d1..1f7ab3ba 100644
--- a/tests/unit/action/test_other_actions.py
+++ b/tests/unit/action/test_other_actions.py
@@ -12,8 +12,8 @@
import pytest
-from src import action, discourse, exceptions
-from src import types_ as src_types
+from gatekeeper import action, discourse, exceptions
+from gatekeeper import types_ as src_types
from ... import factories
from ..helpers import assert_substrings_in_string
diff --git a/tests/unit/action/test_update_action.py b/tests/unit/action/test_update_action.py
index cbb54b57..995fba89 100644
--- a/tests/unit/action/test_update_action.py
+++ b/tests/unit/action/test_update_action.py
@@ -12,8 +12,8 @@
import pytest
-from src import action, discourse, exceptions
-from src import types_ as src_types
+from gatekeeper import action, discourse, exceptions
+from gatekeeper import types_ as src_types
from ... import factories
from ..helpers import assert_substrings_in_string
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
index 359db76f..1d24def7 100644
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -9,8 +9,8 @@
import pytest
import requests
-from src import Clients, constants, repository
-from src.discourse import Discourse
+from gatekeeper import Clients, constants, repository
+from gatekeeper.discourse import Discourse
from . import helpers
diff --git a/tests/unit/helpers.py b/tests/unit/helpers.py
index 61007d3f..8f6e2a2d 100644
--- a/tests/unit/helpers.py
+++ b/tests/unit/helpers.py
@@ -6,8 +6,8 @@
import typing
from pathlib import Path
-from src import metadata
-from src.discourse import _URL_PATH_PREFIX
+from gatekeeper import metadata
+from gatekeeper.discourse import _URL_PATH_PREFIX
def create_metadata_yaml(content: str, path: Path) -> None:
diff --git a/tests/unit/test___init__.py b/tests/unit/test___init__.py
index 5b559d67..70222020 100644
--- a/tests/unit/test___init__.py
+++ b/tests/unit/test___init__.py
@@ -10,7 +10,7 @@
from git.repo import Repo
from github.PullRequest import PullRequest
-from src import ( # GETTING_STARTED,
+from gatekeeper import ( # GETTING_STARTED,
DOCUMENTATION_TAG,
Clients,
constants,
@@ -21,11 +21,11 @@
run_reconcile,
types_,
)
-from src.clients import get_clients
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME
-from src.metadata import METADATA_DOCS_KEY, METADATA_NAME_KEY
-from src.repository import DEFAULT_BRANCH_NAME
-from src.repository import Client as RepositoryClient
+from gatekeeper.clients import get_clients
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME
+from gatekeeper.metadata import METADATA_DOCS_KEY, METADATA_NAME_KEY
+from gatekeeper.repository import DEFAULT_BRANCH_NAME
+from gatekeeper.repository import Client as RepositoryClient
from .. import factories
from ..conftest import BASE_REMOTE_BRANCH
@@ -61,7 +61,7 @@ def test_setup_clients(get_repo_mock, git_repo_with_remote, charm_dir):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_empty_local_server(mocked_clients):
@@ -91,7 +91,7 @@ def test__run_reconcile_empty_local_server(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_empty_local_server_from_non_base_branch(mocked_clients):
@@ -124,7 +124,7 @@ def test__run_reconcile_empty_local_server_from_non_base_branch(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_local_empty_server(mocked_clients):
@@ -171,7 +171,7 @@ def test__run_reconcile_local_empty_server(mocked_clients):
}
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
@pytest.mark.parametrize(
"branch_name",
[pytest.param(DEFAULT_BRANCH), pytest.param("other-main")],
@@ -282,7 +282,7 @@ def patch(path, tag_name) -> str:
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_local_contents_index(mocked_clients):
@@ -340,7 +340,7 @@ def test__run_reconcile_local_contents_index(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_hidden_item(mocked_clients):
@@ -390,7 +390,7 @@ def test__run_reconcile_hidden_item(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_invalid_external_item(mocked_clients):
@@ -424,7 +424,7 @@ def test__run_reconcile_invalid_external_item(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_external_item(mocked_clients):
@@ -470,7 +470,7 @@ def test__run_reconcile_external_item(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_local_empty_server_dry_run(mocked_clients):
@@ -492,7 +492,7 @@ def test__run_reconcile_local_empty_server_dry_run(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_local_empty_server_dry_run_no_tag(mocked_clients, upstream_git_repo):
@@ -518,7 +518,7 @@ def test__run_reconcile_local_empty_server_dry_run_no_tag(mocked_clients, upstre
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_reconcile_local_empty_server_error(mocked_clients):
@@ -550,10 +550,10 @@ def test__run_reconcile_local_empty_server_error(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="index-url"),
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__run_reconcile_local_server_conflict(mock_tag, mocked_clients):
"""
arrange: given metadata with name and docs and docs folder with a file and mocked discourse
@@ -591,7 +591,7 @@ def test__run_reconcile_local_server_conflict(mock_tag, mocked_clients):
mocked_clients.discourse.retrieve_topic.assert_any_call(url=page_url)
-@mock.patch("src.repository.Client.metadata", types_.Metadata(name="name 1", docs=None))
+@mock.patch("gatekeeper.repository.Client.metadata", types_.Metadata(name="name 1", docs=None))
def test__run_reconcile_no_docs(caplog, mocked_clients):
"""
arrange: given metadata with name and no docs and no docs folder and mocked discourse
@@ -611,7 +611,7 @@ def test__run_reconcile_no_docs(caplog, mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
def test__run_reconcile_on_tag_commit(caplog, mocked_clients):
@@ -645,7 +645,7 @@ def test__run_reconcile_on_tag_commit(caplog, mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
def test__run_migrate_server_error_index(repository_client: RepositoryClient):
@@ -669,7 +669,7 @@ def test__run_migrate_server_error_index(repository_client: RepositoryClient):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
def test__run_migrate_server_error_topic(mocked_clients):
@@ -703,7 +703,7 @@ def test__run_migrate_server_error_topic(mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs=None),
)
def test__run_migrate_no_docs_information(caplog, mocked_clients):
@@ -727,7 +727,7 @@ def test__run_migrate_no_docs_information(caplog, mocked_clients):
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
def test__run_migrate(
@@ -781,10 +781,10 @@ def test__run_migrate(
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
-@mock.patch("src.repository.Client.get_pull_request")
+@mock.patch("gatekeeper.repository.Client.get_pull_request")
def test__run_migrate_with_pull_request(
mock_get_pull_request,
mocked_clients,
@@ -844,10 +844,10 @@ def test__run_migrate_with_pull_request(
@mock.patch(
- "src.repository.Client.metadata",
+ "gatekeeper.repository.Client.metadata",
types_.Metadata(name="name 1", docs="http://discourse/t/docs"),
)
-@mock.patch("src.repository.Client.get_pull_request")
+@mock.patch("gatekeeper.repository.Client.get_pull_request")
def test__run_migrate_with_pull_request_no_modification(
mock_get_pull_request,
mocked_clients,
@@ -1118,7 +1118,7 @@ def test_run_migrate_same_content_local_and_server(mock_edit_pull_request, caplo
assert not edit_call_args
-@mock.patch("src.repository.Client.get_pull_request")
+@mock.patch("gatekeeper.repository.Client.get_pull_request")
@mock.patch("github.PullRequest.PullRequest")
def test_run_migrate_same_content_local_and_server_open_pr(
mocked_get_pull_request, mock_edit_pull_request, caplog, mocked_clients, mock_pull_request
diff --git a/tests/unit/test_check.py b/tests/unit/test_check.py
index 06c0efbc..b9461801 100644
--- a/tests/unit/test_check.py
+++ b/tests/unit/test_check.py
@@ -8,7 +8,7 @@
import pytest
-from src import check, types_
+from gatekeeper import check, types_
from .. import factories
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_commit.py b/tests/unit/test_commit.py
index 5e27d2fb..4c1c8c01 100644
--- a/tests/unit/test_commit.py
+++ b/tests/unit/test_commit.py
@@ -9,9 +9,9 @@
import typing
from pathlib import Path
-from src import commit
-from src.constants import DEFAULT_BRANCH
-from src.repository import Client
+from gatekeeper import commit
+from gatekeeper.constants import DEFAULT_BRANCH
+from gatekeeper.repository import Client
def test_parse_git_show_empty():
diff --git a/tests/unit/test_content.py b/tests/unit/test_content.py
index b70a1788..0d471f2c 100644
--- a/tests/unit/test_content.py
+++ b/tests/unit/test_content.py
@@ -5,7 +5,7 @@
import pytest
-from src import content, exceptions
+from gatekeeper import content, exceptions
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_discourse.py b/tests/unit/test_discourse.py
index 50d0d22b..0842546a 100644
--- a/tests/unit/test_discourse.py
+++ b/tests/unit/test_discourse.py
@@ -14,8 +14,8 @@
import pytest
import requests
-from src.discourse import _URL_PATH_PREFIX, Discourse, create_discourse
-from src.exceptions import DiscourseError, InputError
+from gatekeeper.discourse import _URL_PATH_PREFIX, Discourse, create_discourse
+from gatekeeper.exceptions import DiscourseError, InputError
from . import helpers
diff --git a/tests/unit/test_docs_directory.py b/tests/unit/test_docs_directory.py
index c7c281b7..fadb78c5 100644
--- a/tests/unit/test_docs_directory.py
+++ b/tests/unit/test_docs_directory.py
@@ -10,7 +10,7 @@
import pytest
-from src import docs_directory, types_
+from gatekeeper import docs_directory, types_
from .. import factories
diff --git a/tests/unit/test_download.py b/tests/unit/test_download.py
index 58639149..6eb06b6f 100644
--- a/tests/unit/test_download.py
+++ b/tests/unit/test_download.py
@@ -5,9 +5,9 @@
import pytest
-from src import DOCUMENTATION_TAG, constants
-from src.download import recreate_docs
-from src.metadata import METADATA_DOCS_KEY, METADATA_NAME_KEY
+from gatekeeper import DOCUMENTATION_TAG, constants
+from gatekeeper.download import recreate_docs
+from gatekeeper.metadata import METADATA_DOCS_KEY, METADATA_NAME_KEY
from .helpers import create_metadata_yaml
diff --git a/tests/unit/test_index.py b/tests/unit/test_index.py
index 8f370d1b..66eb568b 100644
--- a/tests/unit/test_index.py
+++ b/tests/unit/test_index.py
@@ -11,8 +11,8 @@
import pytest
-from src import constants, discourse, index, types_
-from src.exceptions import DiscourseError, ServerError
+from gatekeeper import constants, discourse, index, types_
+from gatekeeper.exceptions import DiscourseError, ServerError
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_index_contents_get.py b/tests/unit/test_index_contents_get.py
index 600668ef..617293e6 100644
--- a/tests/unit/test_index_contents_get.py
+++ b/tests/unit/test_index_contents_get.py
@@ -8,7 +8,7 @@
import pytest
-from src import index, types_
+from gatekeeper import index, types_
from .. import factories
diff --git a/tests/unit/test_index_contents_hierarchy.py b/tests/unit/test_index_contents_hierarchy.py
index a0c47891..6368fdde 100644
--- a/tests/unit/test_index_contents_hierarchy.py
+++ b/tests/unit/test_index_contents_hierarchy.py
@@ -11,7 +11,7 @@
import pytest
-from src import constants, exceptions, index, types_
+from gatekeeper import constants, exceptions, index, types_
from .. import factories
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_index_contents_parse.py b/tests/unit/test_index_contents_parse.py
index dea675c4..7eef8903 100644
--- a/tests/unit/test_index_contents_parse.py
+++ b/tests/unit/test_index_contents_parse.py
@@ -10,7 +10,7 @@
import pytest
-from src import exceptions, index, types_
+from gatekeeper import exceptions, index, types_
from .. import factories
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_metadata.py b/tests/unit/test_metadata.py
index dcaf8041..f8dcb4c1 100644
--- a/tests/unit/test_metadata.py
+++ b/tests/unit/test_metadata.py
@@ -7,7 +7,7 @@
import pytest
-from src import exceptions, metadata, types_
+from gatekeeper import exceptions, metadata, types_
from .helpers import assert_substrings_in_string, create_charmcraft_yaml, create_metadata_yaml
diff --git a/tests/unit/test_migration/test_private.py b/tests/unit/test_migration/test_private.py
index 5ad8a70a..7e719c1b 100644
--- a/tests/unit/test_migration/test_private.py
+++ b/tests/unit/test_migration/test_private.py
@@ -13,7 +13,7 @@
import pytest
-from src import discourse, exceptions, migration, types_
+from gatekeeper import discourse, exceptions, migration, types_
from ... import factories
from ..helpers import assert_substrings_in_string
diff --git a/tests/unit/test_migration/test_public.py b/tests/unit/test_migration/test_public.py
index 7fd85d8e..2e147768 100644
--- a/tests/unit/test_migration/test_public.py
+++ b/tests/unit/test_migration/test_public.py
@@ -9,7 +9,7 @@
import pytest
-from src import discourse, exceptions, migration, types_
+from gatekeeper import discourse, exceptions, migration, types_
from ... import factories
diff --git a/tests/unit/test_navigation_table.py b/tests/unit/test_navigation_table.py
index baf050fa..6c772beb 100644
--- a/tests/unit/test_navigation_table.py
+++ b/tests/unit/test_navigation_table.py
@@ -8,8 +8,8 @@
import pytest
-from src import exceptions, navigation_table, types_
-from src.exceptions import NavigationTableParseError
+from gatekeeper import exceptions, navigation_table, types_
+from gatekeeper.exceptions import NavigationTableParseError
from .. import factories
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_reconcile.py b/tests/unit/test_reconcile.py
index e6e374a1..cd750681 100644
--- a/tests/unit/test_reconcile.py
+++ b/tests/unit/test_reconcile.py
@@ -13,7 +13,7 @@
import pytest
-from src import constants, exceptions, reconcile, types_
+from gatekeeper import constants, exceptions, reconcile, types_
from .. import factories
from .helpers import assert_substrings_in_string
@@ -213,7 +213,7 @@ def test__local_and_server_file_same(local_content: str, server_content: str, mo
mocked_clients.discourse.retrieve_topic.assert_called_once_with(url=navlink_link)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_content_change_repo_error(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with no changes and discourse client that
@@ -254,7 +254,7 @@ def test__local_and_server_file_content_change_repo_error(mock_get_file, mocked_
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_content_change_repo_tag_not_found(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with no changes and discourse client that
@@ -295,7 +295,7 @@ def test__local_and_server_file_content_change_repo_tag_not_found(mock_get_file,
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_content_change_file_not_in_repo(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with no changes and discourse client that
@@ -340,7 +340,7 @@ def test__local_and_server_file_content_change_file_not_in_repo(mock_get_file, m
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_content_change(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with no changes and discourse client that
@@ -386,7 +386,7 @@ def test__local_and_server_file_content_change(mock_get_file, mocked_clients):
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_content_change_base_content_ws(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with no changes and discourse client that
@@ -435,7 +435,7 @@ def test__local_and_server_file_content_change_base_content_ws(mock_get_file, mo
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_navlink_title_change(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with different navlink title and discourse
@@ -479,7 +479,7 @@ def test__local_and_server_file_navlink_title_change(mock_get_file, mocked_clien
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_file_navlink_hidden_change(mock_get_file, mocked_clients):
"""
arrange: given path info with a file and table row with different navlink hidden and discourse
@@ -525,7 +525,7 @@ def test__local_and_server_file_navlink_hidden_change(mock_get_file, mocked_clie
)
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_directory_same(mock_get_file, mocked_clients):
"""
arrange: given path info with a directory and table row with no changes
@@ -590,7 +590,7 @@ def test__local_and_server_directory_navlink_title_changed(mocked_clients):
mocked_clients.discourse.retrieve_topic.assert_not_called()
-@mock.patch("src.repository.Client.get_file_content_from_tag")
+@mock.patch("gatekeeper.repository.Client.get_file_content_from_tag")
def test__local_and_server_external_ref_same(mock_get_file, mocked_clients):
"""
arrange: given item info with a external ref and table row with no changes
diff --git a/tests/unit/test_repository.py b/tests/unit/test_repository.py
index b85a8a2d..66a356b7 100644
--- a/tests/unit/test_repository.py
+++ b/tests/unit/test_repository.py
@@ -21,15 +21,15 @@
from github.PullRequest import PullRequest
from github.Repository import Repository
-from src import commit, repository
-from src.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME, DOCUMENTATION_TAG
-from src.exceptions import (
+from gatekeeper import commit, repository
+from gatekeeper.constants import DEFAULT_BRANCH, DOCUMENTATION_FOLDER_NAME, DOCUMENTATION_TAG
+from gatekeeper.exceptions import (
InputError,
RepositoryClientError,
RepositoryFileNotFoundError,
RepositoryTagNotFoundError,
)
-from src.repository import Client
+from gatekeeper.repository import Client
from .helpers import assert_substrings_in_string
diff --git a/tests/unit/test_sort.py b/tests/unit/test_sort.py
index 16898251..37810f8b 100644
--- a/tests/unit/test_sort.py
+++ b/tests/unit/test_sort.py
@@ -11,7 +11,7 @@
import pytest
-from src import sort, types_
+from gatekeeper import sort, types_
from .. import factories
diff --git a/tests/unit/test_types_.py b/tests/unit/test_types_.py
index e526d1dd..9226f674 100644
--- a/tests/unit/test_types_.py
+++ b/tests/unit/test_types_.py
@@ -5,7 +5,7 @@
import pytest
-from src import types_
+from gatekeeper import types_
from .. import factories