Skip to content

Commit

Permalink
Use a temporary file for the application_preferences_filename
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Jun 27, 2024
1 parent f18497a commit 44568da
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apptools/preferences/tests/test_scoped_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ class ScopedPreferencesTestCase(PreferencesTestCase):
def setUp(self):
""" Prepares the test fixture before each test method is called. """

self.preferences = ScopedPreferences()
# A temporary directory that can safely be written to.
self.tmpdir = tempfile.mkdtemp()

self.preferences = ScopedPreferences(
application_preferences_filename=os.path.join(
self.tmpdir, "preferences.ini"
)
)

# The filename of the example preferences file.
self.example = os.fspath(files(PKG) / "example.ini")

# A temporary directory that can safely be written to.
self.tmpdir = tempfile.mkdtemp()

def tearDown(self):
""" Called immediately after each test method has been called. """

Expand Down

0 comments on commit 44568da

Please sign in to comment.