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 11# Changelog
22
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+
39## Version 0.15.5
410
511- feat(test-snapshot): while still taking snapshots of the whole state of the
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " python-redux"
3- version = " 0.15.5 "
3+ version = " 0.15.7 "
44description = " Redux implementation for Python"
55authors = [" Sassan Haradji <sassanh@gmail.com>" ]
66license = " Apache-2.0"
Original file line number Diff line number Diff line change 22
33import pytest
44
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+ )
1012
1113from .event_loop import LoopThread , event_loop # noqa: E402
1214from .monitor import StoreMonitor , store_monitor # noqa: E402
Original file line number Diff line number Diff line change @@ -86,18 +86,21 @@ def take(
8686 )
8787 raise RuntimeError (msg )
8888
89+ from pathlib import Path
90+
8991 filename = self .get_filename (title )
90- path = self .results_dir / filename
92+ path = Path ( self .results_dir / filename )
9193 json_path = path .with_suffix ('.jsonc' )
9294 mismatch_path = path .with_suffix ('.mismatch.jsonc' )
9395
9496 new_snapshot = self .json_snapshot (selector = selector )
9597 if self .override :
9698 json_path .write_text (f'// { filename } \n { new_snapshot } \n ' ) # pragma: no cover
9799 else :
98- old_snapshot = None
99- if json_path .exists ():
100+ try :
100101 old_snapshot = json_path .read_text ().split ('\n ' , 1 )[1 ][:- 1 ]
102+ except Exception : # noqa: BLE001
103+ old_snapshot = None
101104 if old_snapshot != new_snapshot :
102105 self ._is_failed = True
103106 mismatch_path .write_text ( # pragma: no cover
You can’t perform that action at this time.
0 commit comments