Skip to content

Commit 49addae

Browse files
committed
Adding Windows/AppVeyor support.
Officially supporting. Needed to handle case insensitive file system in tests.
1 parent acb8ea5 commit 49addae

File tree

5 files changed

+57
-8
lines changed

5 files changed

+57
-8
lines changed

README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ sphinxcontrib-versioning
55
Sphinx extension that allows building versioned docs for self-hosting.
66

77
* Python 2.7, 3.3, 3.4, and 3.5 supported on Linux and OS X.
8+
* Python 2.7, 3.3, 3.4, and 3.5 supported on Windows (both 32 and 64 bit versions of Python).
89

910
📖 Full documentation: https://robpol86.github.io/sphinxcontrib-versioning
1011

12+
.. image:: https://img.shields.io/appveyor/ci/Robpol86/sphinxcontrib-versioning/master.svg?style=flat-square&label=AppVeyor%20CI
13+
:target: https://ci.appveyor.com/project/Robpol86/sphinxcontrib-versioning
14+
:alt: Build Status Windows
15+
1116
.. image:: https://img.shields.io/travis/Robpol86/sphinxcontrib-versioning/master.svg?style=flat-square&label=Travis%20CI
1217
:target: https://travis-ci.org/Robpol86/sphinxcontrib-versioning
1318
:alt: Build Status
@@ -47,8 +52,12 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
4752
Unreleased
4853
----------
4954

55+
Added
56+
* Windows support.
57+
5058
Fixed
5159
* https://github.com/Robpol86/sphinxcontrib-versioning/issues/17
60+
* https://github.com/Robpol86/sphinxcontrib-versioning/issues/3
5261

5362
2.1.4 - 2016-09-03
5463
------------------

appveyor.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Configure.
2+
environment:
3+
PYTHON: Python35
4+
matrix:
5+
- TOX_ENV: lint
6+
- TOX_ENV: py35
7+
- TOX_ENV: py34
8+
- TOX_ENV: py33
9+
- TOX_ENV: py27
10+
- TOX_ENV: py
11+
PYTHON: Python35-x64
12+
- TOX_ENV: py
13+
PYTHON: Python34-x64
14+
- TOX_ENV: py
15+
PYTHON: Python33-x64
16+
- TOX_ENV: py
17+
PYTHON: Python27-x64
18+
19+
# Run.
20+
init: set PATH=C:\%PYTHON%;C:\%PYTHON%\Scripts;%PATH%
21+
build_script: pip install tox
22+
test_script: tox -e %TOX_ENV%
23+
on_success: IF %TOX_ENV% NEQ lint pip install codecov & codecov

tests/test__main__/test_arguments.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from click.testing import CliRunner
77

88
from sphinxcontrib.versioning.__main__ import cli
9+
from sphinxcontrib.versioning.git import IS_WINDOWS
910

1011

1112
@pytest.fixture(autouse=True)
@@ -106,7 +107,10 @@ def test_global_options(monkeypatch, tmpdir, caplog, local_empty, run, push):
106107
result = CliRunner().invoke(cli, args)
107108
config = result.exception.args[0]
108109
assert config.chdir == str(local_empty)
109-
assert config.git_root == str(local_empty)
110+
if IS_WINDOWS:
111+
assert config.git_root.lower() == str(local_empty).lower()
112+
else:
113+
assert config.git_root == str(local_empty)
110114
assert config.local_conf is None
111115
assert config.no_colors is False
112116
assert config.no_local_conf is False
@@ -121,7 +125,10 @@ def test_global_options(monkeypatch, tmpdir, caplog, local_empty, run, push):
121125
result = CliRunner().invoke(cli, args)
122126
config = result.exception.args[0]
123127
assert config.chdir == str(empty)
124-
assert config.git_root == str(repo)
128+
if IS_WINDOWS:
129+
assert config.git_root.lower() == str(repo).lower()
130+
else:
131+
assert config.git_root == str(repo)
125132
assert config.local_conf is None # Overridden by -L.
126133
assert config.no_colors is True
127134
assert config.no_local_conf is True
@@ -141,7 +148,10 @@ def test_global_options(monkeypatch, tmpdir, caplog, local_empty, run, push):
141148
records = [(r.levelname, r.message) for r in caplog.records]
142149
config = result.exception.args[0]
143150
assert config.chdir == str(local_empty)
144-
assert config.git_root == str(local_empty)
151+
if IS_WINDOWS:
152+
assert config.git_root.lower() == str(local_empty).lower()
153+
else:
154+
assert config.git_root == str(local_empty)
145155
assert config.local_conf == join('docs', 'conf.py')
146156
assert config.no_colors is True
147157
assert config.no_local_conf is False

tests/test__main__/test_main_build_scenarios.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,11 @@ def test_error_bad_path(tmpdir, run):
656656

657657
repo = tmpdir.ensure_dir('repo')
658658
run(repo, ['git', 'init'])
659-
empty = tmpdir.ensure_dir('empty')
659+
empty = tmpdir.ensure_dir('empty1857')
660660
with pytest.raises(CalledProcessError) as exc:
661661
run(repo, ['sphinx-versioning', '-N', '-g', str(empty), 'build', '.', str(tmpdir)])
662-
assert 'Failed to find local git repository root in {}.'.format(repr(str(empty))) in exc.value.output
662+
assert 'Failed to find local git repository root in' in exc.value.output
663+
assert 'empty1857' in exc.value.output
663664

664665

665666
def test_error_no_docs_found(tmpdir, local, run):

tests/test_git/test_get_root.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from sphinxcontrib.versioning.git import get_root, GitError
5+
from sphinxcontrib.versioning.git import get_root, GitError, IS_WINDOWS
66

77

88
def test(tmpdir, local_empty):
@@ -16,8 +16,14 @@ def test(tmpdir, local_empty):
1616
get_root(str(tmpdir))
1717

1818
# Test root.
19-
assert get_root(str(local_empty)) == str(local_empty)
19+
if IS_WINDOWS:
20+
assert get_root(str(local_empty)).lower() == str(local_empty).lower()
21+
else:
22+
assert get_root(str(local_empty)) == str(local_empty)
2023

2124
# Test subdir.
2225
subdir = local_empty.ensure_dir('subdir')
23-
assert get_root(str(subdir)) == str(local_empty)
26+
if IS_WINDOWS:
27+
assert get_root(str(subdir)).lower() == str(local_empty).lower()
28+
else:
29+
assert get_root(str(subdir)) == str(local_empty)

0 commit comments

Comments
 (0)