Message ID | 20220225210156.2032055-7-crosa@redhat.com |
---|---|
State | New |
Headers | show |
Series | Avocado tests: filter out tests using TCG booting full blown distros | expand |
On Fri, Feb 25, 2022 at 04:01:53PM -0500, Cleber Rosa wrote: > If the test is skipped because of their conditionals, the shared_dir > attribute may not exist. > > Check for its existence in the tearDown() method to avoid and > AttributeError. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/avocado/virtiofs_submounts.py | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/tests/avocado/virtiofs_submounts.py b/tests/avocado/virtiofs_submounts.py > index e6dc32ffd4..d9c2c9d9ef 100644 > --- a/tests/avocado/virtiofs_submounts.py > +++ b/tests/avocado/virtiofs_submounts.py > @@ -157,9 +157,10 @@ def tearDown(self): > except: > pass > > - scratch_dir = os.path.join(self.shared_dir, 'scratch') > - self.run(('bash', self.get_data('cleanup.sh'), scratch_dir), > - ignore_error=True) > + if hasattr(self, 'shared_dir'): > + scratch_dir = os.path.join(self.shared_dir, 'scratch') > + self.run(('bash', self.get_data('cleanup.sh'), scratch_dir), > + ignore_error=True) > > def test_pre_virtiofsd_set_up(self): > self.set_up_shared_dir() Reviewed-by: Beraldo Leal <bleal@redhat.com> -- Beraldo
diff --git a/tests/avocado/virtiofs_submounts.py b/tests/avocado/virtiofs_submounts.py index e6dc32ffd4..d9c2c9d9ef 100644 --- a/tests/avocado/virtiofs_submounts.py +++ b/tests/avocado/virtiofs_submounts.py @@ -157,9 +157,10 @@ def tearDown(self): except: pass - scratch_dir = os.path.join(self.shared_dir, 'scratch') - self.run(('bash', self.get_data('cleanup.sh'), scratch_dir), - ignore_error=True) + if hasattr(self, 'shared_dir'): + scratch_dir = os.path.join(self.shared_dir, 'scratch') + self.run(('bash', self.get_data('cleanup.sh'), scratch_dir), + ignore_error=True) def test_pre_virtiofsd_set_up(self): self.set_up_shared_dir()
If the test is skipped because of their conditionals, the shared_dir attribute may not exist. Check for its existence in the tearDown() method to avoid and AttributeError. Signed-off-by: Cleber Rosa <crosa@redhat.com> --- tests/avocado/virtiofs_submounts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)