Skip to content

Commit

Permalink
Move the tests outside the installed package
Browse files Browse the repository at this point in the history
There's no need to install the test suite alongside the codebase.

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
  • Loading branch information
abompard committed Jun 2, 2022
1 parent 0ac2023 commit 4b7bb51
Show file tree
Hide file tree
Showing 272 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Expand Up @@ -14,5 +14,5 @@ exclude_lines =
pragma: no cover
if __name__ == .__main__.:
omit =
noggin/tests/*
tests/*
noggin/__init__.py
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Expand Up @@ -29,13 +29,13 @@ repos:
hooks:
- id: python-bandit-vulnerability-check
alias: bandit
args: ["-r", "noggin/", "-x", "noggin/tests/", "-ll"]
args: ["-r", "noggin/", "-ll"]
# - repo: local
# hooks:
# - id: bandit-local
# name: bandit
# entry: bandit
# args: ["-r", "noggin/", "-x", "noggin/tests/", "-ll"]
# args: ["-r", "noggin/", "-ll"]
# pass_filenames: false
# language: system

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Expand Up @@ -110,7 +110,6 @@ def run_apidoc(_):
"-o",
os.path.join(topdir, "docs", "_source"),
os.path.join(topdir, "noggin"),
os.path.join(topdir, "noggin", "tests"),
]
)

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Expand Up @@ -26,6 +26,7 @@ include = [
{ path = "babel.cfg", format = "sdist" },
{ path = "docs/*", format = "sdist" },
{ path = "docs/*/*", format = "sdist" },
{ path = "tests/*", format = "sdist" },
]

classifiers = [
Expand Down Expand Up @@ -186,7 +187,7 @@ force_alphabetical_sort_within_sections = true

[tool.pytest.ini_options]
testpaths = [
"noggin/tests/unit",
"tests/unit",
]

[build-system]
Expand Down
6 changes: 1 addition & 5 deletions sonar-project.properties
@@ -1,10 +1,6 @@
sonar-project.properties
sonar.organization=fedora-infra
sonar.projectKey=fedora-infra/noggin
sonar.sources=noggin
sonar.host.url=https://sonarcloud.io
sonar.login=a36fe78f64abe3b8e6db0df06a6b399c2abc2e24
sonar.test.exclusions=**/noggin/tests/*
sonar.tests=tests
sonar.exclusions=/devel/create-test-data.py, /noggin/themes/*/static/, /noggin/templates/*,


File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -8,7 +8,8 @@
from flask import current_app, get_flashed_messages, session

from noggin.app import ipa_admin
from noggin.tests.unit.utilities import (

from ..utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
Expand Down
Expand Up @@ -10,13 +10,6 @@
from noggin.app import ipa_admin, mailer
from noggin.representation.user import User
from noggin.security.ipa import untouched_ipa_client
from noggin.tests.unit.utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
get_otp,
otp_secret_from_uri,
)
from noggin.utility.password_reset import PasswordResetLock
from noggin.utility.token import (
Audience,
Expand All @@ -26,6 +19,14 @@
)
from noggin_messages import UserUpdateV1

from ..utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
get_otp,
otp_secret_from_uri,
)


@pytest.fixture
def token_for_dummy_user(dummy_user):
Expand Down
Expand Up @@ -8,9 +8,10 @@
from flask import Markup

from noggin.app import ipa_admin
from noggin.tests.unit.utilities import assert_redirects_with_flash
from noggin_messages import MemberSponsorV1

from ..utilities import assert_redirects_with_flash


@pytest.mark.vcr()
def test_groups_list(client, logged_in_dummy_user, dummy_group):
Expand Down
Expand Up @@ -4,12 +4,13 @@
from fedora_messaging import testing as fml_testing

from noggin.app import ipa_admin
from noggin.tests.unit.utilities import (
from noggin_messages import UserUpdateV1

from ..utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
)
from noggin_messages import UserUpdateV1


def test_password_reset(client):
Expand Down
Expand Up @@ -10,13 +10,14 @@
from noggin.representation.user import User
from noggin.security.ipa import maybe_ipa_login
from noggin.signals import stageuser_created, user_registered
from noggin.tests.unit.utilities import (
from noggin.utility.token import Audience, make_token
from noggin_messages import UserCreateV1

from ..utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
)
from noggin.utility.token import Audience, make_token
from noggin_messages import UserCreateV1


@pytest.fixture
Expand Down
File renamed without changes.
Expand Up @@ -8,13 +8,11 @@

from noggin.app import ipa_admin, mailer
from noggin.representation.user import User
from noggin.tests.unit.utilities import (
assert_form_generic_error,
assert_redirects_with_flash,
)
from noggin.utility.token import Audience, make_token
from noggin_messages import UserUpdateV1

from ..utilities import assert_form_generic_error, assert_redirects_with_flash


POST_CONTENTS = {
"firstname": "Dummy",
Expand Down
Expand Up @@ -8,7 +8,8 @@

from noggin.app import ipa_admin
from noggin.representation.otptoken import OTPToken
from noggin.tests.unit.utilities import (

from ..utilities import (
assert_form_field_error,
assert_form_generic_error,
assert_redirects_with_flash,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -5,7 +5,8 @@
from bs4 import BeautifulSoup

import noggin
from noggin.tests.unit.utilities import assert_redirects_with_flash

from ..utilities import assert_redirects_with_flash


@pytest.fixture
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tox.ini
Expand Up @@ -9,8 +9,8 @@ requires =
passenv = HOME
sitepackages = false
commands =
unittest: pytest -vv --cov --cov-append --cov-report= noggin/tests/unit {posargs}
integration: pytest -vv --no-cov noggin/tests/integration {posargs}
unittest: pytest -vv --cov --cov-append --cov-report= tests/unit {posargs}
integration: pytest -vv --no-cov tests/integration {posargs}
depends =
{py39,py310}: covclean
covreport: py39-unittest,py310-unittest
Expand Down

0 comments on commit 4b7bb51

Please sign in to comment.