<s> from path import path <EOL> import pytest <EOL> from tempfile import mkdtemp <EOL> @ pytest . yield_fixture ( scope = '<STR_LIT>' ) <EOL> def temp_folder_factory ( ) : <EOL> created = set ( ) <EOL> def factory ( reserve_only = False ) : <EOL> temp_dir = mkdtemp ( ) <EOL> if reserve_only : <EOL> path ( temp_dir ) . rmtree ( ignore_errors = True ) <EOL> created . add ( temp_dir ) <EOL> return path ( temp_dir ) <EOL> yield factory <EOL> for to_delete in created : <EOL> path ( to_delete ) . rmtree ( ignore_errors = True ) <EOL> def assert_entities_equal ( entity , other ) : <EOL> assert isinstance ( other , type ( entity ) ) <EOL> assert entity . __dict__ == other . __dict__ </s>
