Skip to content

BaseCase inheritance and pytest addoptions. #1383

Answered by mdmintz
oggeche asked this question in Q&A

You must be logged in to vote

Hello,
When using pytest fixtures with SeleniumBase, you'll want to use one of the syntax formats that uses the sb fixture instead of BaseCase inheritance, because pytest fixtures don't work with tests that inherit unittest.TestCase. You can use the "The classic Page Object Model with the sb pytest fixture" for this.

Or, you can use the existing --env=ENV option to pass the ENV to the tests, where you can put your if statement in there. Eg. --env=staging, --env=qa, --env=test, --env=production, --env=develop. Then use self.env to access that environment in your tests. You have to use one of the predefined values: (choose from 'qa', 'staging', 'develop', 'production', 'master', 'remote', '…

Replies: 1 comment 1 reply

You must be logged in to vote
1 reply
@oggeche

Answer selected by oggeche
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants