File tree Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Expand file tree Collapse file tree 4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## Version 0.15.7
4
+
5
+ - refactor(test-snapshot): make it aligned with ` pyfakefs ` by using ` try ` /` except `
6
+ instead of checking ` Path().exists() ` as ` pyfakefs ` doesn't seem to respect ` skip_names `
7
+ for ` Path().exists() `
8
+
3
9
## Version 0.15.5
4
10
5
11
- feat(test-snapshot): while still taking snapshots of the whole state of the
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " python-redux"
3
- version = " 0.15.5 "
3
+ version = " 0.15.7 "
4
4
description = " Redux implementation for Python"
5
5
authors = [
" Sassan Haradji <[email protected] >" ]
6
6
license = " Apache-2.0"
Original file line number Diff line number Diff line change 2
2
3
3
import pytest
4
4
5
- pytest .register_assert_rewrite ('redux_pytest.fixtures.event_loop' )
6
- pytest .register_assert_rewrite ('redux_pytest.fixtures.monitor' )
7
- pytest .register_assert_rewrite ('redux_pytest.fixtures.snapshot' )
8
- pytest .register_assert_rewrite ('redux_pytest.fixtures.store' )
9
- pytest .register_assert_rewrite ('redux_pytest.fixtures.wait_for' )
5
+ pytest .register_assert_rewrite (
6
+ 'redux_pytest.fixtures.event_loop' ,
7
+ 'redux_pytest.fixtures.monitor' ,
8
+ 'redux_pytest.fixtures.snapshot' ,
9
+ 'redux_pytest.fixtures.store' ,
10
+ 'redux_pytest.fixtures.wait_for' ,
11
+ )
10
12
11
13
from .event_loop import LoopThread , event_loop # noqa: E402
12
14
from .monitor import StoreMonitor , store_monitor # noqa: E402
Original file line number Diff line number Diff line change @@ -86,18 +86,21 @@ def take(
86
86
)
87
87
raise RuntimeError (msg )
88
88
89
+ from pathlib import Path
90
+
89
91
filename = self .get_filename (title )
90
- path = self .results_dir / filename
92
+ path = Path ( self .results_dir / filename )
91
93
json_path = path .with_suffix ('.jsonc' )
92
94
mismatch_path = path .with_suffix ('.mismatch.jsonc' )
93
95
94
96
new_snapshot = self .json_snapshot (selector = selector )
95
97
if self .override :
96
98
json_path .write_text (f'// { filename } \n { new_snapshot } \n ' ) # pragma: no cover
97
99
else :
98
- old_snapshot = None
99
- if json_path .exists ():
100
+ try :
100
101
old_snapshot = json_path .read_text ().split ('\n ' , 1 )[1 ][:- 1 ]
102
+ except Exception : # noqa: BLE001
103
+ old_snapshot = None
101
104
if old_snapshot != new_snapshot :
102
105
self ._is_failed = True
103
106
mismatch_path .write_text ( # pragma: no cover
You can’t perform that action at this time.
0 commit comments