diff options
author | Petr Viktorin <pviktori@redhat.com> | 2014-10-08 09:42:52 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2014-11-21 12:14:44 +0100 |
commit | 93c69b51278ef5a6b04047b7d38f619101d0d184 (patch) | |
tree | 6ad3481e6b360f7abd99771121ddf737161c03ac /ipatests/test_cmdline | |
parent | 84bd4c12469aa74e45182f47f8c9845922085777 (diff) | |
download | freeipa-93c69b51278ef5a6b04047b7d38f619101d0d184.tar.gz freeipa-93c69b51278ef5a6b04047b7d38f619101d0d184.tar.xz freeipa-93c69b51278ef5a6b04047b7d38f619101d0d184.zip |
Use setup_class/teardown_class in Declarative tests
Pytest will consider each Declarative test individually, running
setup/teardown for each one.
Move the setup and teardown to the class level.
https://fedorahosted.org/freeipa/ticket/4610
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipatests/test_cmdline')
-rw-r--r-- | ipatests/test_cmdline/cmdline.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py index bcb71328a..81d3301b2 100644 --- a/ipatests/test_cmdline/cmdline.py +++ b/ipatests/test_cmdline/cmdline.py @@ -52,27 +52,22 @@ class cmdline_test(XMLRPC_test): # some reasonable default command command = paths.LS - def setup(self): + @classmethod + def setup_class(cls): # Find the executable in $PATH # This is neded because ipautil.run resets the PATH to # a system default. - original_command = self.command - if not os.path.isabs(self.command): - self.command = distutils.spawn.find_executable(self.command) + original_command = cls.command + if not os.path.isabs(cls.command): + cls.command = distutils.spawn.find_executable(cls.command) # raise an error if the command is missing even if the remote # server is not available. - if not self.command: + if not cls.command: raise AssertionError( 'Command %r not available' % original_command ) - super(cmdline_test, self).setup() + super(cmdline_test, cls).setup_class() if not server_available: raise nose.SkipTest( 'Server not available: %r' % api.env.xmlrpc_uri ) - - def teardown(self): - """ - nose tear-down fixture. - """ - super(cmdline_test, self).teardown() |