Skip to content

Commit 933888f

Browse files
committed
update tests
1 parent 1b6c113 commit 933888f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
* Added `LazyLoadSession.delete` to delete items from the data store.
13+
* Added classmethod `LazyLoadSession.delete_instance` to delete the existing instance of a session.
1314

1415
### Changed
1516

src/compas_session/lazyload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LazyLoadSession:
7878
"""
7979

8080
@classmethod
81-
def reset(cls):
81+
def delete_instance(cls):
8282
cls._instance = None
8383

8484
_instance = None

tests/test_lazy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
def test_session_noname():
6-
LazyLoadSession.reset()
6+
LazyLoadSession.delete_instance()
77

88
session = LazyLoadSession()
99
assert session.name == "tests"
@@ -15,12 +15,12 @@ def test_session_inheritance():
1515
class Session(LazyLoadSession):
1616
pass
1717

18-
Session.reset()
18+
Session.delete_instance()
1919

2020
session = Session()
2121
assert session.name == "tests"
2222

23-
Session.reset()
23+
Session.delete_instance()
2424

2525
session = Session(name="A")
2626
assert session.name == "A"
@@ -30,15 +30,15 @@ class Session(LazyLoadSession):
3030

3131
@pytest.mark.xfail(raises=SingletonError)
3232
def test_session_name_empty():
33-
LazyLoadSession.reset()
33+
LazyLoadSession.delete_instance()
3434

3535
session = LazyLoadSession(name="")
3636

3737
session.delete_dirs()
3838

3939

4040
def test_session_singleton():
41-
LazyLoadSession.reset()
41+
LazyLoadSession.delete_instance()
4242

4343
a = LazyLoadSession()
4444
b = LazyLoadSession()
@@ -60,7 +60,7 @@ def test_session_singleton():
6060

6161

6262
def test_session_settings():
63-
LazyLoadSession.reset()
63+
LazyLoadSession.delete_instance()
6464

6565
a = LazyLoadSession()
6666
b = LazyLoadSession()
@@ -71,7 +71,7 @@ def test_session_settings():
7171

7272

7373
def test_session_settings_values():
74-
LazyLoadSession.reset()
74+
LazyLoadSession.delete_instance()
7575

7676
a = LazyLoadSession()
7777
b = LazyLoadSession()

0 commit comments

Comments
 (0)