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

Prefix with underscore the private objects from testutils #1438

Closed
cpennington opened this issue Apr 21, 2017 · 4 comments
Closed

Prefix with underscore the private objects from testutils #1438

cpennington opened this issue Apr 21, 2017 · 4 comments

Comments

@cpennington
Copy link

Steps to reproduce

  1. Run the tests for https://github.com/landscapeio/pylint-django

Current behavior

The tests break with

Traceback (most recent call last):
  File "test/test_func.py", line 6, in <module>
    from pylint.testutils import make_tests, LintTestUsingFile, cb_test_gen, linter
ImportError: cannot import name make_tests

Expected behavior

The tests pass.

The make_tests function was removed in 2fa1375

@PCManticore
Copy link
Contributor

To be honest, something as testutils should be considered private, outside of maybe a couple of functions from that file.

@cpennington
Copy link
Author

@PCManticore: yeah, that's fair. The difficulty is that as an author of a pylint plugin, there's no clear pattern for writing a test of that plugin, except for pylint itself. https://github.com/landscapeio/pylint-django (not mine), and https://github.com/edx/edx-lint (mine) both ran afoul of this when that function was removed.

@ceridwen
Copy link

If it's a private API, shouldn't it be marked as _testutils.py? Or are all of pylint's APIs private? If so, that ought to be indicated somewhere. At least astroid's __init__.py has some indications of what the private and public APIs are. As it is, there's little documentation (and realistically no one's stepping up to improve that) and this has caught two users. If not a leading underscore, a note somewhere about what is and isn't private?

@PCManticore
Copy link
Contributor

That's a reasonable suggestion, we could probably prefix the private APIs with underscore, leaving only the handful public APis untouched. Nobody managed to do that so far because it wasn't a concern to anyone and the problem with the removed functionality is that it was for an obsolete testing methodology of Pylint (being obsoleted by test_functional, which is way saner than the former).

@PCManticore PCManticore reopened this Apr 21, 2017
@PCManticore PCManticore changed the title make_tests was removed, and breaks tests written for other pylint plugins Prefix with underscore the private objects from testutils Apr 21, 2017
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

No branches or pull requests

3 participants