Skip to content

Commit

Permalink
fix and test env var passing between fixtures and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luto committed Jul 16, 2024
1 parent 5dea76a commit a1fd088
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/shellinspector/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/900_fixtures.ispec
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ settings:
fixture_dirs:
- fixtures
---
%~ id create_user
% echo $USRNAME
create_user
%~ id $USRNAME
create_user
3 changes: 2 additions & 1 deletion tests/e2e/fixtures/create_user_pre.ispec
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
% adduser -D create_user
% export USRNAME=create_user
% adduser -D $USRNAME
2 changes: 1 addition & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,6 @@ def test_fixture():
assert specfile.fixture == "e2e/fixtures/create_user"
assert not specfile.errors, specfile.errors
assert specfile.fixture_specfile_pre
assert len(specfile.fixture_specfile_pre.commands) == 1
assert len(specfile.fixture_specfile_pre.commands) == 2
assert specfile.fixture_specfile_post
assert len(specfile.fixture_specfile_post.commands) == 1

0 comments on commit a1fd088

Please sign in to comment.