Don't fail on git_pillar tests when destructive tests are not enable

This fixes the following when running `python tests/runtests.py --ext-pillar`:

 --------  Tests with Errors  ------------------------------------------------------------------------------------------------------------------------
   -> tearDownClass (integration.pillar.test_git_pillar.TestGitPythonSSH)  ...........................................................................
       Traceback (most recent call last):
         File ".../salt/tests/support/gitfs.py", line 481, in tearDownClass
           if cls.case.sshd_proc is not None:
       AttributeError: 'NoneType' object has no attribute 'sshd_proc'
   ...................................................................................................................................................
   -> tearDownClass (integration.pillar.test_git_pillar.TestPygit2SSH)  ..............................................................................
       Traceback (most recent call last):
         File ".../salt/tests/support/gitfs.py", line 481, in tearDownClass
           if cls.case.sshd_proc is not None:
       AttributeError: 'NoneType' object has no attribute 'sshd_proc'
   ...................................................................................................................................................
 -----------------------------------------------------------------------------------------------------------------------------------------------------

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
(cherry picked from commit 84e9fce9bb)
This commit is contained in:
Mathieu Parent 2018-11-05 15:48:32 +01:00
parent 46514818a5
commit ba150a5182
No known key found for this signature in database
GPG key ID: AE03980466681FA5

View file

@ -538,6 +538,8 @@ class GitPillarSSHTestBase(GitPillarTestBase, SSHDMixin):
@classmethod
def tearDownClass(cls):
if cls.case is None:
return
if cls.case.sshd_proc is not None:
cls.case.sshd_proc.send_signal(signal.SIGTERM)
cls.case.run_state('user.absent', name=cls.username, purge=True)