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

dealing with empty context names #833

Open
techtonik opened this issue Aug 6, 2019 · 4 comments
Open

dealing with empty context names #833

techtonik opened this issue Aug 6, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@techtonik
Copy link

techtonik commented Aug 6, 2019

Just run into the same issue as #796.

image

I'm always frustrated when I don't understand what's happening. Although my guess was the same - that (empty) context is an import, I thought I open another issue to clarify how to deal with that.

Describe the solution you'd like

  1. The most basic thing that could help is to name the context as (import) or {import}, so that people won't have to guess.

  2. Then it could be the top level file where import is coming from as {import}: filename

  3. Then it could be the import stack {import}: filename1 -> filename2

Describe alternatives you've considered

The alternative is to display "import stack" in Python flat "import space" rather than "filesystem space". But it is more practical to know the filename rather than {level1}.somethings.{lamdba15}.something internal address.

Perhaps it is possible to store both.

Additional context

Avoid using word "context" as it is too abstract as the title above says. Once you get the details, it is easy, but the path through abstractions is not. Give more examples and database queries.

Also, add foreign keys to allow diagram tools automatically link tables?


Forgot to add - that stuff is super awesome. =)

@techtonik techtonik added the enhancement New feature or request label Aug 6, 2019
@nedbat
Copy link
Owner

nedbat commented Aug 6, 2019

The empty context might be more than just "imports". It's any code run before an explicit context has been set. When using pytest test contexts, it's all the code run by pytest before a test begins.

I understand that "(empty)" isn't very helpful, but I'm not sure what else I can use as a label in the absence of any information.

@nedbat
Copy link
Owner

nedbat commented Aug 6, 2019

Good idea about the foreign keys. I've added those on master.

@techtonik
Copy link
Author

In case of pytest - does that include the code before coverage is initialized? I am right that the process is the following.

  1. pytest runs and discovers tests - no coverage
  2. pytest initializes coverage
  3. run each test

So, any pytest code that is run after coverage initialization is also a part of report? I thought that there is mechanism to exclude those files from coverage.

@nedbat
Copy link
Owner

nedbat commented Aug 6, 2019

It depends how you are running coverage. First, you might not be using pytest at all. Second, you might be running pytest under coverage ("coverage run -m pytest"). In this case, all of pytest is being measured, even the test discovery. If you run coverage from within the pytest plugin ("--cov"), I'm not sure when coverage measurement starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants