make sure cmd is not run when npm isn't installed

apparently the skipIf on the functions still get run, even if the function is
going to be skipped based on a skipIf on the class.
This commit is contained in:
Daniel Wallace 2017-08-11 10:58:00 -06:00
parent b458b89fb8
commit da3402a53d

View file

@ -54,7 +54,8 @@ class NpmStateTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
ret = self.run_state('npm.installed', name=None, pkgs=['pm2', 'grunt'])
self.assertSaltTrueReturn(ret)
@skipIf(LooseVersion(cmd.run('npm -v')) >= LooseVersion(MAX_NPM_VERSION), 'Skip with npm >= 5.0.0 until #41770 is fixed')
@skipIf(salt.utils.which('npm') and LooseVersion(cmd.run('npm -v')) >= LooseVersion(MAX_NPM_VERSION),
'Skip with npm >= 5.0.0 until #41770 is fixed')
@destructiveTest
def test_npm_cache_clean(self):
'''