-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changed import of reexport to explicit and bumped version * Replaced all import * with explicit imports and moved global update into a function * Formatting with yapf applied.\nVersion reverted to orig version 0.5.0+dev\nPipenv files added to gitignore * Added tests for pylint and jedi * Fixed formatting * Added pylint and jedit to test-requirements.txt for tests * Fixed path to be POSIX and Windows path * Replaced trio/__init__.py with trio.__file__ * Module names for _core and _run are currently broken * Changed import of reexport to explicit and bumped version * Formatting with yapf applied.\nVersion reverted to orig version 0.5.0+dev\nPipenv files added to gitignore * Added tests for pylint and jedi * Fixed path to be POSIX and Windows path * Module names for _core and _run are currently broken * replaced __all__ with namespace iteration and added pylint and jedi test * replaced __all__ with namespace iteration and added pylint and jedi test * merged with 0.6.0 rebase * rebase continuation * Fix formating with yapf * Removed _top_level_imports.py * Reformatted with new yapf version 0.22 and skipped yedi test for 3.8-dev * Fixed format in test_exports.py * Fixed mising import of pytest in test_exports.py * Changed reson message for jedi test being skipped * Moved to exception handling instead of pytest decorator for skipping test on non supported jedi python version * changed TLD of readthedocs from org to io * Addressed temporary issue with __all__ being still present in _core but not in trio * more changes accepted * rebasing * Changed import of reexport to explicit and bumped version * Added tests for pylint and jedi * Fixed formatting * Fixed path to be POSIX and Windows path * replaced __all__ with namespace iteration and added pylint and jedi test * rebase continuation * Fix formating with yapf * Reformatted with new yapf version 0.22 and skipped yedi test for 3.8-dev * Fixed format in test_exports.py * Addressed temporary issue with __all__ being still present in _core but not in trio * Rebase formatting * Fixed formatting after rebase * Synced .gitignore * removed again TaskLocal from trio/__init__.py * reverted docs changes, removed TESTING variable and removed explicit list from _core/__init__.py * Changed jedi completion test script to be an explicit script * added open_signal_receiver to trio/__init__.py and _toplevel_core_reexports.py * Fixed formatting of trio/_toplevel_core_reexports.py * Added extra space after curly brace to check what happens about yapf on ci complaining about formatting * Deleted trio/_toplevel_core_reexports.py
- Loading branch information
Showing
6 changed files
with
71 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
import trio | ||
import trio.testing | ||
|
||
import jedi | ||
import os | ||
import pytest | ||
import sys | ||
|
||
from pylint.lint import PyLinter | ||
|
||
from .. import _core | ||
|
||
|
||
def test_core_is_properly_reexported(): | ||
# Each export from _core should be re-exported by exactly one of these | ||
# three modules: | ||
sources = [trio, trio.hazmat, trio.testing] | ||
for symbol in _core.__all__: | ||
for symbol in dir(_core): | ||
if symbol.startswith('_') or symbol == 'tests': | ||
continue | ||
found = 0 | ||
for source in sources: | ||
if ( | ||
symbol in source.__all__ | ||
symbol in dir(source) | ||
and getattr(source, symbol) is getattr(_core, symbol) | ||
): | ||
found += 1 | ||
print(symbol, found) | ||
assert found == 1 | ||
|
||
|
||
def test_pylint_sees_all_non_underscore_symbols_in_namespace(): | ||
# Test pylints ast to contain the same content as dir(trio) | ||
linter = PyLinter() | ||
ast_set = set(linter.get_ast(trio.__file__, 'trio')) | ||
trio_set = set([symbol for symbol in dir(trio) if symbol[0] != '_']) | ||
trio_set.remove('tests') | ||
assert trio_set - ast_set == set([]) | ||
|
||
|
||
def test_jedi_sees_all_completions(): | ||
# Test the jedi completion library get all in dir(trio) | ||
try: | ||
script = jedi.Script("import trio; trio.") | ||
completions = script.completions() | ||
trio_set = set([symbol for symbol in dir(trio) if symbol[:2] != '__']) | ||
jedi_set = set([cmp.name for cmp in completions]) | ||
assert trio_set - jedi_set == set([]) | ||
except NotImplementedError: | ||
pytest.skip("jedi does not yet support {}".format(sys.version)) |