'How to run coverage for a Python project with src-layout?

My python project is structured in the so called src-layout.

hyperorg
├── README.md
├── setup.cfg
├── setup.py
├── src
│   └── hyperorg
│       ├── content.py
│       ├── exporter.py
│       ├── __init__.py
│       ├── __main__.py
│       └── reader.py
└── tests
    ├── helper.py
    ├── __init__.py
    ├── test_content.py
    ├── test_exporter.py
    ├── test_hyperorg.py
    └── test_reader.py

I am not able to get coverage running for it. How can I do this?

What I tried so far

Run coverage in the projects root folder just gives me Nothing to run.

Or coverage run ./src/hyperorg gives me

Traceback (most recent call last):
File "/home/user/tab-cloud/hyperorg/src/hyperorg/__main__.py", line 6, in <module>
from .content import Content
ImportError: attempted relative import with no known parent package


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source