From f490b1d75f66943a35e6fa5ba95723902ae9ad31 Mon Sep 17 00:00:00 2001 From: luto Date: Tue, 16 Jul 2024 16:31:07 +0200 Subject: [PATCH] fix and test env var passing between fixtures and tests --- src/shellinspector/runner.py | 2 +- tests/e2e/900_fixtures.ispec | 4 +++- tests/e2e/fixtures/create_user_pre.ispec | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shellinspector/runner.py b/src/shellinspector/runner.py index a83b04d..dfab120 100644 --- a/src/shellinspector/runner.py +++ b/src/shellinspector/runner.py @@ -460,7 +460,7 @@ def run(self, specfile: Specfile, outer_used_sessions=None): self.run(specfile.fixture_specfile_post, used_sessions) finally: - if not outer_used_sessions: + if outer_used_sessions is None: for session in used_sessions: session.pop_state() diff --git a/tests/e2e/900_fixtures.ispec b/tests/e2e/900_fixtures.ispec index 104a793..063d170 100644 --- a/tests/e2e/900_fixtures.ispec +++ b/tests/e2e/900_fixtures.ispec @@ -4,5 +4,7 @@ settings: fixture_dirs: - fixtures --- -%~ id create_user +% echo $USRNAME +create_user +%~ id $USRNAME create_user diff --git a/tests/e2e/fixtures/create_user_pre.ispec b/tests/e2e/fixtures/create_user_pre.ispec index 47b91a9..f4ba286 100644 --- a/tests/e2e/fixtures/create_user_pre.ispec +++ b/tests/e2e/fixtures/create_user_pre.ispec @@ -1 +1,2 @@ -% adduser -D create_user +% export USRNAME=create_user +% adduser -D $USRNAME