Skip to content

Commit 32bb2a4

Browse files
authored
fix: use warnings.catch_warnings() instead of pytest.warns(None) (#741)
1 parent f54b5a5 commit 32bb2a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/test_rest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
import alpaca_trade_api as tradeapi
23
from alpaca_trade_api.rest import APIError
34

@@ -1172,7 +1173,7 @@ def callback_429(request, context):
11721173

11731174

11741175
def test_no_resource_warning_with_context_manager():
1175-
with pytest.warns(None) as record: # ensure no warnings are raised
1176-
with tradeapi.REST('key-id', 'secret-key', api_version='v1') as api:
1176+
with warnings.catch_warnings(): # ensure no warnings are raised
1177+
warnings.simplefilter("error")
1178+
with tradeapi.REST("key-id", "secret-key", api_version="v1") as api:
11771179
assert api
1178-
assert not record

0 commit comments

Comments
 (0)