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

collect-only incompatible with nosedep #12

Closed
chickenandpork opened this issue Oct 31, 2018 · 9 comments
Closed

collect-only incompatible with nosedep #12

chickenandpork opened this issue Oct 31, 2018 · 9 comments

Comments

@chickenandpork
Copy link

nosetests -v -w ${test_subdir} --collect-only -s ./test.py:testClassName would be used to collect the names f the tests but not actually run them. It's useful for listing out generated test names using nose-parameterized

With nosedep, the following no longer just lists tests, but tries to execute them:

nosetests --with-nosedep -v -w ${test_subdir} --collect-only -s ./test.py:testClassName

This seems to be unexpected behavior: I would expect --collect-only to still only collect the names of tests.

Zitrax added a commit that referenced this issue Nov 2, 2018
@Zitrax
Copy link
Owner

Zitrax commented Nov 2, 2018

Hi and thanks for your report. I added simple unit tests for this since there were none, but they pass without further changes.

I haven't investigated the syntax of specifying the classname in the end that you use yet though, does it have any effect you regarding this?

If not is it possible that you could provide me with some simple sample code that reproduce the issue?

@chickenandpork
Copy link
Author

Based on your decorated_functional_dep_skip.py:

from unittest import SkipTest, TestCase
from nosedep import depends

class decorated_functional_dep_skip(TestCase):

    @classmethod
    def setupClass(cls):
        assert False

    @depends(after='test_dfds_b')
    def test_dfds_a():
        pass

    def test_dfds_b():
        raise AssertionError("UNGA HAZA")

    def test_dfds_c():
        assert False
        pass

    @depends(after='not_existing_test')
    def test_dfds_d():
        pass

    def test_dfds_e():
        raise SkipTest('skippington')

    @depends(after=test_dfds_e)
    def test_dfds_f():
        pass

Execute with: nosetests --with-xunit --with-nosedep -v --collect-only test.py

You'll notice that the setupClass() method gets executed despite --collect-only, triggering the failed assertion. Without --with-nosedep the setupClass() is not executed.

@Zitrax
Copy link
Owner

Zitrax commented Nov 8, 2018

I see, thanks for the update. I'll have a look.

Zitrax added a commit that referenced this issue Nov 10, 2018
As documented prepareTestLoader() can only be used by one plugin thus we are
incompatible with --collect-only. Detect that and disable nosedep.

Also added further unittest to verify this.
@Zitrax
Copy link
Owner

Zitrax commented Nov 10, 2018

As can be seen in the doc prepareTestLoader() can only be used by a single plugin. Thus this seem to mean that collect and nosedep are not compatible together. I added a commit that will detect if collect is in use and then nosedep disables itself.

That means you can't collect to get the tests printed in dependency order of course, but at least there should not be any surprises of running the setup/teardown when collecting.

@chickenandpork
Copy link
Author

chickenandpork commented Nov 11, 2018 via email

@chickenandpork
Copy link
Author

FIXED :)

Hand-applying your nosedep.py change, I see a better result. Are you willing to ship this change (even as a point/patch related like 0.6.1) so we can update our requirements.txt ? Thanks!

@Zitrax
Copy link
Owner

Zitrax commented Nov 12, 2018

Thanks for reporting and testing, I'll look into releasing.

@Zitrax
Copy link
Owner

Zitrax commented Nov 12, 2018

Released as 0.7.

@chickenandpork
Copy link
Author

chickenandpork commented Nov 12, 2018 via email

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

2 participants