Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark tests that should not run without PyScaffold's src #416

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ markers =
system: mark system tests
original_logger: do not isolate logger in specific tests
no_fake_config_dir: avoid the autofixture fake_config_dir to take effect
requires_src: tests that require the raw source of PyScaffold and assume our default CI environment
log_level = DEBUG
log_cli = True
log_cli_level = CRITICAL
Expand Down
8 changes: 8 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
from uuid import uuid4
from warnings import warn

import pytest

skip_on_conda_build = pytest.mark.skipif(
os.getenv("CONDA_BUILD"),
reason="conda build does not run inside virtualenv/tox and "
"it does not have PyScaffold's source code available when running tests",
)


def uniqstr():
"""Generates a unique random long string every time it is called"""
Expand Down
3 changes: 3 additions & 0 deletions tests/system/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pyscaffold.file_system import chdir
from pyscaffold.info import read_pyproject

from ..helpers import skip_on_conda_build
from .helpers import run, run_common_tasks

pytestmark = [pytest.mark.slow, pytest.mark.system]
Expand All @@ -27,6 +28,8 @@ def cwd(tmpdir):
yield tmpdir


@skip_on_conda_build
@pytest.mark.requires_src
def test_ensure_inside_test_venv(putup):
# This is a METATEST
# Here we ensure `putup` is installed inside tox so we know we are testing the
Expand Down
8 changes: 8 additions & 0 deletions tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from pyscaffold import __version__, info, update
from pyscaffold.file_system import chdir

from .helpers import skip_on_conda_build

EDITABLE_PYSCAFFOLD = re.compile(r"^-e.+pyscaffold.*$", re.M | re.I)


Expand Down Expand Up @@ -123,6 +125,8 @@ def venv_mgr(tmpdir, venv, pytestconfig):


@pytest.mark.slow
@pytest.mark.requires_src
@skip_on_conda_build
def test_update_version_3_0_to_3_1(with_coverage, venv_mgr):
project = Path(venv_mgr.venv_path, "my_old_project")
(
Expand All @@ -137,6 +141,8 @@ def test_update_version_3_0_to_3_1(with_coverage, venv_mgr):


@pytest.mark.slow
@pytest.mark.requires_src
@skip_on_conda_build
def test_update_version_3_0_to_3_1_pretend(with_coverage, venv_mgr):
project = Path(venv_mgr.venv_path, "my_old_project")
(
Expand All @@ -151,6 +157,8 @@ def test_update_version_3_0_to_3_1_pretend(with_coverage, venv_mgr):


@pytest.mark.slow
@pytest.mark.requires_src
@skip_on_conda_build
def test_inplace_update(with_coverage, venv_mgr):
# Given an existing project
project = Path(venv_mgr.tmpdir) / "my-ns-proj"
Expand Down