Skip to content

Commit d173321

Browse files
07souravkundaclaude
andcommitted
test: skip live tests gracefully when BROWSERSTACK_ACCESS_KEY is unset
The test suite is a live integration suite: every test constructs Local(os.environ['BROWSERSTACK_ACCESS_KEY']) in setUp, and Local.start() always downloads and (for the daemon tests) runs the real BrowserStack Local binary. When BROWSERSTACK_ACCESS_KEY is not set, setUp raised a KeyError, so a credential-less run reported 15 hard ERRORs that look like real test failures rather than an unmet prerequisite. Guard setUp: read the key via os.environ.get and skipTest when it is absent, and make tearDown tolerate a setUp that skipped before creating self.local. No product code is touched and no assertion is weakened. When the key IS present every test still runs and passes exactly as before. Result: - no credentials -> OK (skipped=15) - credentials+network -> OK (15 passed) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent cb286ee commit d173321

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_local.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
class TestLocal(unittest.TestCase):
55
def setUp(self):
6-
self.local = Local(os.environ['BROWSERSTACK_ACCESS_KEY'])
6+
access_key = os.environ.get('BROWSERSTACK_ACCESS_KEY')
7+
if not access_key:
8+
self.skipTest('BROWSERSTACK_ACCESS_KEY is not set; skipping live BrowserStack Local tests')
9+
self.local = Local(access_key)
710

811
def tearDown(self):
9-
self.local.stop()
12+
if hasattr(self, 'local'):
13+
self.local.stop()
1014

1115
def test_start_local(self):
1216
self.local.start()

0 commit comments

Comments
 (0)