|
1 | 1 | """Test function in module.""" |
2 | 2 |
|
| 3 | +from os.path import join |
| 4 | + |
3 | 5 | import pytest |
4 | 6 |
|
5 | 7 | from sphinxcontrib.versioning.git import export |
@@ -30,9 +32,9 @@ def test_single(tmpdir, local_docs, urls): |
30 | 32 | '_sources', |
31 | 33 | '_static', |
32 | 34 | 'master', |
33 | | - 'master/.doctrees', |
34 | | - 'master/_sources', |
35 | | - 'master/_static', |
| 35 | + join('master', '.doctrees'), |
| 36 | + join('master', '_sources'), |
| 37 | + join('master', '_static'), |
36 | 38 | ] |
37 | 39 | assert actual == expected |
38 | 40 |
|
@@ -76,20 +78,20 @@ def test_multiple(tmpdir, config, local_docs, run, urls, triple, parallel): |
76 | 78 | '_sources', |
77 | 79 | '_static', |
78 | 80 | 'master', |
79 | | - 'master/.doctrees', |
80 | | - 'master/_sources', |
81 | | - 'master/_static', |
| 81 | + join('master', '.doctrees'), |
| 82 | + join('master', '_sources'), |
| 83 | + join('master', '_static'), |
82 | 84 | 'v1.0.0', |
83 | | - 'v1.0.0/.doctrees', |
84 | | - 'v1.0.0/_sources', |
85 | | - 'v1.0.0/_static', |
| 85 | + join('v1.0.0', '.doctrees'), |
| 86 | + join('v1.0.0', '_sources'), |
| 87 | + join('v1.0.0', '_static'), |
86 | 88 | ] |
87 | 89 | if triple: |
88 | 90 | expected.extend([ |
89 | 91 | 'v1.0.1', |
90 | | - 'v1.0.1/.doctrees', |
91 | | - 'v1.0.1/_sources', |
92 | | - 'v1.0.1/_static', |
| 92 | + join('v1.0.1', '.doctrees'), |
| 93 | + join('v1.0.1', '_sources'), |
| 94 | + join('v1.0.1', '_static'), |
93 | 95 | ]) |
94 | 96 | assert actual == expected |
95 | 97 |
|
@@ -165,8 +167,8 @@ def test_banner_branch(tmpdir, banner, config, local_docs, run, show_banner): |
165 | 167 | build_all(str(exported_root), str(dst), versions) |
166 | 168 | actual = sorted(f.relto(dst) for f in dst.visit(lambda p: p.basename in ('contents.html', 'one.html', 'two.html'))) |
167 | 169 | expected = [ |
168 | | - 'contents.html', 'master/contents.html', 'master/one.html', |
169 | | - 'old_build/contents.html', 'old_build/one.html', 'old_build/two.html', 'one.html' |
| 170 | + 'contents.html', join('master', 'contents.html'), join('master', 'one.html'), |
| 171 | + join('old_build', 'contents.html'), join('old_build', 'one.html'), join('old_build', 'two.html'), 'one.html' |
170 | 172 | ] |
171 | 173 | assert actual == expected |
172 | 174 |
|
@@ -241,13 +243,18 @@ def test_banner_tag(tmpdir, banner, config, local_docs, run, recent): |
241 | 243 | build_all(str(exported_root), str(dst), versions) |
242 | 244 | actual = sorted(f.relto(dst) |
243 | 245 | for f in dst.visit(lambda p: p.basename in ('contents.html', 'one.html', 'two.html', 'too.html'))) |
244 | | - expected = ['contents.html', 'master/contents.html', 'master/one.html', 'master/too.html', 'one.html', 'too.html'] |
| 246 | + expected = [ |
| 247 | + 'contents.html', |
| 248 | + join('master', 'contents.html'), join('master', 'one.html'), join('master', 'too.html'), |
| 249 | + 'one.html', |
| 250 | + 'too.html', |
| 251 | + ] |
245 | 252 | if recent: |
246 | | - expected = ['201612/contents.html', '201612/one.html', '201612/too.html'] + expected |
247 | | - expected = ['201611/contents.html', '201611/one.html', '201611/two.html'] + expected |
| 253 | + expected = [join('201612', 'contents.html'), join('201612', 'one.html'), join('201612', 'too.html')] + expected |
| 254 | + expected = [join('201611', 'contents.html'), join('201611', 'one.html'), join('201611', 'two.html')] + expected |
248 | 255 | else: |
249 | | - expected += ['v1.0.0/contents.html', 'v1.0.0/one.html', 'v1.0.0/two.html'] |
250 | | - expected += ['v2.0.0/contents.html', 'v2.0.0/one.html', 'v2.0.0/too.html'] |
| 256 | + expected += [join('v1.0.0', 'contents.html'), join('v1.0.0', 'one.html'), join('v1.0.0', 'two.html')] |
| 257 | + expected += [join('v2.0.0', 'contents.html'), join('v2.0.0', 'one.html'), join('v2.0.0', 'too.html')] |
251 | 258 | assert actual == expected |
252 | 259 |
|
253 | 260 | # Verify master banner. |
|
0 commit comments