Skip to content

rgw: add nose dependency for rgw_multisite_tests task#1069

Merged
vasukulkarni merged 1 commit intomasterfrom
wip-nose-for-rgw-multi
May 18, 2017
Merged

rgw: add nose dependency for rgw_multisite_tests task#1069
vasukulkarni merged 1 commit intomasterfrom
wip-nose-for-rgw-multi

Conversation

@cbodley
Copy link
Contributor

@cbodley cbodley commented Apr 27, 2017

nose is a dependency for ceph/ceph#14688, which builds a qa suite around the existing rgw multisite tests in src/test/rgw/test_multi.py. those tests need to be invoked by the teuthology task itself, because they run radosgw-admin commands on different nodes, start/stop daemons, etc

@vasukulkarni
Copy link
Contributor

LGTM

zmc
zmc previously requested changes May 2, 2017
setup.py Outdated
'configobj',
'six >= 1.9', # python-openstackclient won't work properly with less
'httplib2',
'nose',
Copy link
Member

Choose a reason for hiding this comment

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

I don't love the idea of adding a dependency for just one task, but I don't have a better solution yet. In the meantime could you add a comment explaining what this new dep is for? I don't want the reason to get buried in commit history.

@cbodley cbodley force-pushed the wip-nose-for-rgw-multi branch from 60f797a to 65b4f37 Compare May 2, 2017 19:01
@cbodley
Copy link
Contributor Author

cbodley commented May 2, 2017

thanks @zmc, added a comment. i agree that it's not ideal, but the only alternative i could think of was rewriting all of the existing tests for unittest (someday, maybe..)

@alfredodeza
Copy link
Contributor

Actually, py.test has support for nosetests :) So this shouldn't even be necessary? Also, please keep in mind that even though nosetests is used in the suites, it is no longer maintained, and that has been the case for a while.

@cbodley
Copy link
Contributor Author

cbodley commented May 2, 2017

hi @alfredodeza, i'm not familiar with py.test, but that sounds promising. are there any examples you could point me at?

@vasukulkarni
Copy link
Contributor

there are quite a few known issues running nosetests using py.test, https://docs.pytest.org/en/latest/nose.html, Better to run them with nose than with py.test

@alfredodeza
Copy link
Contributor

@cbodley I think that if you just try pytest instead of nose as the executable, things should just work.

Certainly, like @vasukulkarni points out, there is no 100% support for everything nose has (e.g. classes that don't inherit from unittest.TestCase will not work), but worth give it a shot to help transition the tests to a supported test runner.

@cbodley
Copy link
Contributor Author

cbodley commented May 2, 2017

@cbodley I think that if you just try pytest instead of nose as the executable, things should just work.

i'm using the nose api to run the tests within the rgw_multisite_tests task, so i'd have to do something similar with pytest (it looks like there's a pytest.main() for that)

e.g. classes that don't inherit from unittest.TestCase will not work

that's a problem, then. the tests in src/test/rgw/rgw_multi/tests.py are free functions

@cbodley
Copy link
Contributor Author

cbodley commented May 2, 2017

e.g. classes that don't inherit from unittest.TestCase will not work

that's a problem, then. the tests in src/test/rgw/rgw_multi/tests.py are free functions

maybe not. running those tests on the command line with pytest, it seems to find the test functions just fine. i'll give pytest.main() a try in the rgw_multisite_tests task

@cbodley
Copy link
Contributor Author

cbodley commented May 3, 2017

@alfredodeza i'm having trouble getting pytest.main() to do what i need here - my main requirement is that it runs tests in an already-imported rgw_multi.tests module, because the rgw_multisite_tests task needs to set up the test environment. it does this and calls rgw_multi.tests.init_multi(realm, user), which sets some global variables that are used by all of the tests

i tried using pytest.main(['--pyargs', tests.__name__]) to do this, but it appears to load a separate module, and the tests fail because those global variables are None

@cbodley
Copy link
Contributor Author

cbodley commented May 4, 2017

i don't see pytest listed as a dependency either - is that coming from somewhere else?

testing my updated suite on ovh, i got Could not find task 'rgw_multisite_tests', which i'm guessing was due to the import pytest

@zmc
Copy link
Member

zmc commented May 4, 2017

@cbodley Ah, we don't list pytest as a dependency since it's only been used for unit tests so far. If you have things working with pytest, we can definitely add it as a dependency.

@cbodley cbodley force-pushed the wip-nose-for-rgw-multi branch from 65b4f37 to 7240331 Compare May 5, 2017 04:04
@cbodley cbodley changed the title rgw: add nose dependency for rgw_multisite_tests task rgw: add pytest dependency for rgw_multisite_tests task May 5, 2017
@cbodley
Copy link
Contributor Author

cbodley commented May 5, 2017

updated pr, now adds pytest dependency

Signed-off-by: Casey Bodley <cbodley@redhat.com>
@cbodley cbodley force-pushed the wip-nose-for-rgw-multi branch from 7240331 to 8782b23 Compare May 9, 2017 18:57
@cbodley
Copy link
Contributor Author

cbodley commented May 10, 2017

i changed the dependency back to nose. i was able to get it 'working' with pytest, but i couldn't get pytest to print its results to the teuthology log. the nose api gives more control over logging, so i decided to stick with that

@cbodley cbodley changed the title rgw: add pytest dependency for rgw_multisite_tests task rgw: add nose dependency for rgw_multisite_tests task May 10, 2017
@alfredodeza
Copy link
Contributor

py.test "captures" stderr and stdout, and spits them out if there are any failures. If you wish to disable that capturing (done so that test runner output is clean) then there is a flag for that: -s

@cbodley
Copy link
Contributor Author

cbodley commented May 10, 2017

@alfredodeza i tried passing each of -s, --capture=no, and --capture=sys without success

@cbodley
Copy link
Contributor Author

cbodley commented May 10, 2017

with help from @alfredodeza, i did make some progressing in getting pytest output into teuthology.log

but in further testing, i realized that the tests themselves depend on nose (for nose.tools, nose.plugins.attrib, nose.plugins.skip), so i don't think there's a way to work around that

can we merge this as is?

@cbodley
Copy link
Contributor Author

cbodley commented May 12, 2017

ping @zmc

1 similar comment
@cbodley
Copy link
Contributor Author

cbodley commented May 17, 2017

ping @zmc

@vasukulkarni
Copy link
Contributor

@zmc is on pto this week, If you have run the tests with this change and post the results I can merge.

@cbodley
Copy link
Contributor Author

cbodley commented May 18, 2017

thanks @vasukulkarni, here's the last successful run of the rgw:multisite suite that uses nose: http://pulpito.ceph.com/cbodley-2017-05-16_10:46:23-rgw:multisite-master---basic-smithi/

the jobs fail with valgrind issues, but the tests themselves pass:

INFO:tasks.rgw_multisite_tests:----------------------------------------------------------------------
INFO:tasks.rgw_multisite_tests:Ran 11 tests in 921.748s
INFO:tasks.rgw_multisite_tests:
INFO:tasks.rgw_multisite_tests:OK

@vasukulkarni vasukulkarni merged commit 236bdb0 into master May 18, 2017
@vasukulkarni vasukulkarni deleted the wip-nose-for-rgw-multi branch May 18, 2017 17:23
zmc added a commit that referenced this pull request Jun 14, 2017
We forgot to run pip-compile in PR #1069

Signed-off-by: Zack Cerza <zack@redhat.com>
zmc added a commit that referenced this pull request Jun 14, 2017
We forgot to run pip-compile in PR #1069

Signed-off-by: Zack Cerza <zack@redhat.com>
cbodley added a commit to cbodley/teuthology that referenced this pull request May 23, 2024
after upgrading teuthology to centos 9 and python 3.10, the rgw
multisite test suite now fails to invoke nosetests with:

> AttributeError: module 'collections' has no attribute 'Callable'

this is a known issue tracked in nose-devs/nose#1127

Shilpa found a new 'pynose' package which claims that:

> This version of nose is compatible with Python 3.7+ (including 3.13+).

replace the nose dependency that i initially added in
ceph#1069 with the current version
1.5.1 of pynose

to prepare this pr, i first changed setup.cfg then ran:

> ./update-requirements.sh -P "pynose==1.5.1"

Signed-off-by: Casey Bodley <cbodley@redhat.com>
cbodley added a commit to cbodley/teuthology that referenced this pull request May 23, 2024
after upgrading teuthology to centos 9 and python 3.10, the rgw
multisite test suite now fails to invoke nosetests with:

> AttributeError: module 'collections' has no attribute 'Callable'

this is a known issue tracked in nose-devs/nose#1127

Shilpa found a new 'pynose' package which claims that:

> This version of nose is compatible with Python 3.7+ (including 3.13+).

replace the nose dependency that i initially added in
ceph#1069 with the current version
1.5.1 of pynose

to prepare this pr, i first changed setup.cfg then ran:

> ./update-requirements.sh -P "pynose==1.5.1"

Fixes: https://tracker.ceph.com/issues/66183

Signed-off-by: Casey Bodley <cbodley@redhat.com>
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.

4 participants