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

pytest_ckan interferes with standard pytest procedures #7281

Open
ChristianF88 opened this issue Dec 15, 2022 · 0 comments
Open

pytest_ckan interferes with standard pytest procedures #7281

ChristianF88 opened this issue Dec 15, 2022 · 0 comments
Assignees

Comments

@ChristianF88
Copy link

ChristianF88 commented Dec 15, 2022

Sorry for writing this issue here, but pytest-ckan doesn't take issues.

CKAN version: 2.97

Describe the bug

I am writing an extension. For some base functionalities I can write ckan-independant tests. I skip a few tests, as they're not as "robust". In order to be able to choose running them anyways I implemented a cli hook. When I only had pytest installed everything worked fine. Now I ran the installation of pytest-ckan. Since I did that:

  1. my implemented command for the cli dont work
  2. I need to provide a ckan test.ini, otherwise pytest doesnt run at all

How can I run tests, that are marked to be skipped?

Steps to reproduce
an example test:

import pytest
@pytest.mark.skip(reason="Hardcoded Eawag user name!")
def test_generate_staff_profile_url(request_code):
    assert 200== 200

confest.py

import pytest
import _pytest.skipping

def pytest_addoption(parser):
    parser.addoption(
        "--no-skips",
        action="store_true",
        default=False, help="disable skip marks")


@pytest.hookimpl(tryfirst=True)
def pytest_cmdline_preparse(config, args):
    if "--no-skips" not in args:
        return

    def no_skip(*args, **kwargs):
        return

    _pytest.skipping.skip = no_skip

Expected behavior
What I expect is that I am not forced to pass a ckan.ini if my tests don't require it and that if I do my added cli commands work.

Additional details

pytest --version
This is pytest version 4.6.5, imported from /usr/lib/ckan/default/lib/python3.9/site-packages/pytest.py
setuptools registered plugins:
  pyfakefs-3.2 at /usr/lib/ckan/default/lib/python3.9/site-packages/pyfakefs/pytest_plugin.py
  Faker-15.3.3 at /usr/lib/ckan/default/lib/python3.9/site-packages/faker/contrib/pytest/plugin.py
  pytest-split-tests-1.0.9 at /usr/lib/ckan/default/lib/python3.9/site-packages/pytest_split_tests/__init__.py
  pytest-cov-2.7.1 at /usr/lib/ckan/default/lib/python3.9/site-packages/pytest_cov/plugin.py
  pytest-freezegun-0.4.1 at /usr/lib/ckan/default/lib/python3.9/site-packages/pytest_freezegun.py
  pytest-ckan-0.0.12 at /usr/lib/ckan/default/lib/python3.9/site-packages/pytest_ckan/__init__.py
  pytest-rerunfailures-8.0 at /usr/lib/ckan/default/lib/python3.9/site-packages/pytest_rerunfailures.py
@amercader amercader self-assigned this Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants