Skip to content

Commit

Permalink
Try using a temporary directory to see if that works in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bboe committed Feb 24, 2021
1 parent bb0e005 commit 31ef0c4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/unit/util/test_token_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test praw.util.refresh_token_manager."""
from tempfile import NamedTemporaryFile
from tempfile import TemporaryDirectory
from unittest import mock
import os

import pytest

Expand Down Expand Up @@ -78,10 +79,11 @@ def test_is_registered(self):
assert not manager.is_registered()

def test_multiple_instances(self):
with NamedTemporaryFile() as fp:
manager1 = SQLiteTokenManager(fp.name, "dummy_key1")
manager2 = SQLiteTokenManager(fp.name, "dummy_key1")
manager3 = SQLiteTokenManager(fp.name, "dummy_key2")
with TemporaryDirectory() as directory:
path = os.path.join(directory, "db.sqlite")
manager1 = SQLiteTokenManager(path, "dummy_key1")
manager2 = SQLiteTokenManager(path, "dummy_key1")
manager3 = SQLiteTokenManager(path, "dummy_key2")

manager1.register("dummy_value1")
assert manager2.is_registered()
Expand Down

0 comments on commit 31ef0c4

Please sign in to comment.