comparison tests/test_sources_posts.py @ 1021:22e767899e52

tests: Fix path comparison in a test on Windows.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 05 Dec 2017 22:30:27 -0800
parents 45ad976712ec
children
comparison
equal deleted inserted replaced
1020:298b07a899b5 1021:22e767899e52
1 import os.path 1 import os.path
2 import pytest 2 import pytest
3 from .mockutil import mock_fs, mock_fs_scope 3 from .mockutil import mock_fs, mock_fs_scope
4 from .pathutil import slashfix
4 5
5 6
6 @pytest.mark.parametrize( 7 @pytest.mark.parametrize(
7 'fs_fac, src_type, expected_paths, expected_metadata', 8 'fs_fac, src_type, expected_paths, expected_metadata',
8 [ 9 [
37 with mock_fs_scope(fs): 38 with mock_fs_scope(fs):
38 app = fs.getApp() 39 app = fs.getApp()
39 s = app.getSource('test') 40 s = app.getSource('test')
40 items = list(s.getAllContents()) 41 items = list(s.getAllContents())
41 paths = [os.path.relpath(f.spec, s.fs_endpoint_path) for f in items] 42 paths = [os.path.relpath(f.spec, s.fs_endpoint_path) for f in items]
42 assert paths == expected_paths 43 assert paths == slashfix(expected_paths)
43 metadata = [ 44 metadata = [
44 (f.metadata['route_params']['year'], 45 (f.metadata['route_params']['year'],
45 f.metadata['route_params']['month'], 46 f.metadata['route_params']['month'],
46 f.metadata['route_params']['day'], 47 f.metadata['route_params']['day'],
47 f.metadata['route_params']['slug']) 48 f.metadata['route_params']['slug'])