Skip to content

Pytest with automatic compilation #888

@shmygol

Description

@shmygol

I'd like to run coconut tests with pytest using automatic compilation. Is there a chance to do it?

I'f added flags "--assert=plain" and "-s" and .coco suffix to the pytest hook like this:

def pytest_collect_file(file_path, parent):
    if file_path.name.startswith('test_') and file_path.suffix == '.coco':
        return pytest.Module.from_parent(parent, path = file_path)

But I get import file mismatch error.

import file mismatch:
imported module 'tests.core.use_cases.test_user' has this __file__ attribute:
  .../tests/core/use_cases/test_user.py
which is not the same as the test file we want to collect:
  .../tests/core/use_cases/test_user.coco
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

Do you have an idea how I could make pytest stop complaining about the mismatch? Maybe with hooks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions