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

Generalize namespace static analysis tests #756

Merged
merged 1 commit into from
Oct 29, 2018

Conversation

njsmith
Copy link
Member

@njsmith njsmith commented Oct 29, 2018

This switches to a single parametrized test that covers all of Trio's
public namespaces, and if it fails, then it prints a nice readable
list of the missing symbols.

Also adds the symbols that were missing from trio.socket's static
import list on my laptop, and adds some comments to trio.socket while
I'm at it.

CC: @jmfrank63 @Zac-HD

This switches to a single parametrized test that covers all of Trio's
public namespaces, and if it fails, then it prints a nice readable
list of the missing symbols.

Also adds the symbols that were missing from trio.socket's static
import list on my laptop, and adds some comments to trio.socket while
I'm at it.
@codecov
Copy link

codecov bot commented Oct 29, 2018

Codecov Report

Merging #756 into master will decrease coverage by 0.01%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #756      +/-   ##
==========================================
- Coverage   99.34%   99.32%   -0.02%     
==========================================
  Files          96       96              
  Lines       11586    11597      +11     
  Branches      827      831       +4     
==========================================
+ Hits        11510    11519       +9     
- Misses         56       57       +1     
- Partials       20       21       +1
Impacted Files Coverage Δ
trio/socket.py 100% <ø> (ø) ⬆️
trio/tests/test_exports.py 96.42% <95%> (-3.58%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df5a8f3...6647d65. Read the comment docs.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! (And works on macOS 10.14.)

for (_name, _value) in _stdlib_socket.__dict__.items()
if _name.isupper() and not _name.startswith('_')
_name: getattr(_stdlib_socket, _name)
for _name in _stdlib_socket.__all__ if _name.isupper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to change this again?

if not value.__name__.startswith(module.__name__):
continue
if value is module:
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This line does not seem to be covered by the tests.)

@pquentin pquentin merged commit 9a0e837 into python-trio:master Oct 29, 2018
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

Successfully merging this pull request may close these issues.

3 participants