Skip to content

Improve Pytest environment handling in Actor._get_default_exit_process #641

@vdusek

Description

@vdusek

Description

Method Actor._get_default_exit_process currently contains the following logic:

# Check if running in Pytest by detecting the relevant environment variable.
if os.getenv('PYTEST_CURRENT_TEST'):
    self.log.debug('Running in Pytest, setting default `exit_process` to False.')
    return False

This behavior is incorrect - production code should not adjust its defaults based on test environment detection. The logic should be inverted: instead of the SDK adapting to Pytest during normal execution, the test environment should explicitly configure the exit_process flag as needed.

Expected fix:

  • Remove the Pytest-specific condition from the production code.
  • Handle exit_process=False setup within the test environment (e.g., via test fixtures or explicit configuration).

Metadata

Metadata

Assignees

Labels

debtCode quality improvement or decrease of technical debt.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions