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

PR: remove spyder/widgets/tests/__init__.py because of error in execution of pytest -rxs #3581

Merged
merged 1 commit into from
Oct 22, 2016
Merged

Conversation

malliwi88
Copy link
Contributor

@ccordoba12 @goanpeca

According to Good Practices for Pytest. The structure for test layout / import rules on spyder/spyder/widgets/tests/ doesn't need __init__.py file.

If we don't need to keep the test names. It solves errors messages over execution of pytest -rxs

  • with init.py
    seleccion_001
  • without init.py
    seleccion_002

Additionally, pytest -rxs let us see specific location of XFAIL error over test. It facilitates the detection of faults in problems such as auto_indent those reported @rlaverde.

@malliwi88 malliwi88 changed the title remove __init__.py because generate error in execution of pytest -rxs PR: remove __init__.py because generate error in execution of pytest -rxs Oct 22, 2016
@malliwi88
Copy link
Contributor Author

As I can see in Spyder Dev Testing

When using pytest directly, the command is basically py.test (there are some gotchas, explained below). This runs all tests in .....
If you use pytest directly, you need to make sure that the root of the Spyder source tree is included in the Python path, because the test files import spyder and its modules. You can use the PYTHONPATH environment variable for this. If you don't do this, then the tests will fail, or (if you have Spyder installed) they will test the installed version of Spyder.

Instead Pytest Doc say this about of layout/test functionality

avoid “init.py” files in your test directories. This way your tests can run easily against an installed version of mypkg, independently from the installed package if it contains the tests or not.

So avoiding conflict over pytest execution on development such as picture above or this reported problem on StackOverflow Question

@jitseniesen
Copy link
Member

This is a good idea (actually, I thought I had already done this myself!). The pytest docs are a bit ambivalent, because in the next paragraph they say:

With inlined tests [which we have] you might put __init__.py into test directories and make them installable as part of your application.

But I think it's indeed better to remove __init__.py. In any case, we should be consistent, and there is only one test directory with __init__.py.

@malliwi88 Feel free to edit Spyder Dev Testing. It's just something I wrote without too much thought.

@ccordoba12 ccordoba12 modified the milestones: v3.x, v3.0.2 Oct 22, 2016
@ccordoba12
Copy link
Member

Thanks @malliwi88!! Merging now :-)

@ccordoba12 ccordoba12 changed the title PR: remove __init__.py because generate error in execution of pytest -rxs PR: remove spyder/widgets/tests/__init__.py because generate error in execution of pytest -rxs Oct 22, 2016
@ccordoba12 ccordoba12 changed the title PR: remove spyder/widgets/tests/__init__.py because generate error in execution of pytest -rxs PR: remove spyder/widgets/tests/__init__.py because of error in execution of pytest -rxs Oct 22, 2016
@ccordoba12 ccordoba12 merged commit 9434aa6 into spyder-ide:3.x Oct 22, 2016
ccordoba12 added a commit that referenced this pull request Oct 22, 2016
@malliwi88 malliwi88 deleted the fix/pytest-error branch October 22, 2016 17:31
@malliwi88 malliwi88 restored the fix/pytest-error branch October 22, 2016 19:54
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