Skip to content

who-tests-what: empty context names #796

@fersarr

Description

@fersarr

I have been using who-tests-what and wanted to ask about the empty context names I have found and perhaps have this as a future reference.

For example, if I have 2 files:

A source file source_1.py

1
2  def multiply(a, b):
3          return a * b
4

and a test file test_file_1.py

1  import source_1
2
3  def test_source1():
4          assert 30 == source_1.multiply(5,6)

with .coveragerc as follows:

[run]
dynamic_context = test_function

Then using coverage (version 5.0a4 with C extension) I run the tests and generate the coverage DB .coverage:

$ py.test --cov=. test_file_1.py
...
$ sqlite3 .coverage "select * from context;"
1|
2|test_source1

As you can see, the first context is empty. Why is that? What does it mean?

This is what the DB looks like:

$ sqlite3 .coverage "select * from file, context, line where file.id = line.file_id and line.context_id=context.id"
1|/.../workspace/coverage_tests/test_file_1.py|1||1|1|1
1|/.../workspace/coverage_tests/test_file_1.py|1||1|1|3
2|/.../workspace/coverage_tests/source_1.py|1||2|1|2
1|/.../workspace/coverage_tests/test_file_1.py|2|test_source1|1|2|4
2|/.../workspace/coverage_tests/source_1.py|2|test_source1|2|2|3

My Environment

Python 3.6.5
Coverage 5.0a4 with C extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions