Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit 9d8f5c2

Browse files
committed
Merge branch 'py3'
2 parents 73d3036 + 8a27da7 commit 9d8f5c2

File tree

7 files changed

+28
-18
lines changed

7 files changed

+28
-18
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ _build
44
_readthedocs_build
55
autoapi
66
_build_rtd
7-
/.tox/
7+
.tox
8+
dist

.travis.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
language: python
22
python:
33
- 2.7
4+
- 3.4
5+
- 3.5
6+
- 3.6
47
sudo: false
5-
env:
6-
- TOX_ENV=py27-unittest
7-
- TOX_ENV=py27-integration
8-
- TOX_ENV=lint
9-
#- TOX_ENV=docs
108
install:
11-
- pip install tox
9+
- pip install tox-travis
1210
script:
13-
- tox -e $TOX_ENV
11+
- tox
1412
notifications:
1513
slack:
1614
rooms:

readthedocs_build/config/config.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def error(self, key, message, code):
9393
raise InvalidConfig(
9494
key=key,
9595
code=code,
96-
error_message='{source}: {message}'.format(source=source, message=message),
96+
error_message='{source}: {message}'.format(source=source,
97+
message=message),
9798
source_file=self.source_file,
9899
source_position=self.source_position)
99100

@@ -105,7 +106,7 @@ def catch_validation_error(self, key):
105106
raise InvalidConfig(
106107
key=key,
107108
code=error.code,
108-
error_message=error.message,
109+
error_message=str(error),
109110
source_file=self.source_file,
110111
source_position=self.source_position)
111112

@@ -375,7 +376,7 @@ def load(path, env_config):
375376
raise ConfigError(
376377
'Parse error in {filename}: {message}'.format(
377378
filename=filename,
378-
message=error.message),
379+
message=str(error)),
379380
code=CONFIG_SYNTAX_INVALID)
380381
for i, config in enumerate(configs):
381382
build_config = BuildConfig(

readthedocs_build/config/test_validation.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from mock import patch
33
from pytest import raises
44
import os
5+
from six import text_type
56

67
from .validation import validate_bool
78
from .validation import validate_choice
@@ -85,7 +86,7 @@ def describe_validate_directory():
8586
def it_uses_validate_path(tmpdir):
8687
patcher = patch('readthedocs_build.config.validation.validate_path')
8788
with patcher as validate_path:
88-
path = unicode(tmpdir.mkdir('a directory'))
89+
path = text_type(tmpdir.mkdir('a directory'))
8990
validate_path.return_value = path
9091
validate_directory(path, str(tmpdir))
9192
validate_path.assert_called_with(path, str(tmpdir))
@@ -150,11 +151,11 @@ def describe_validate_string():
150151

151152
def it_accepts_unicode():
152153
result = validate_string(u'Unicöde')
153-
assert isinstance(result, unicode)
154+
assert isinstance(result, text_type)
154155

155156
def it_accepts_nonunicode():
156157
result = validate_string('Unicode')
157-
assert isinstance(result, unicode)
158+
assert isinstance(result, text_type)
158159

159160
def it_rejects_float():
160161
with raises(ValidationError) as excinfo:

readthedocs_build/config/validation.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from six import string_types, text_type
23

34

45
INVALID_BOOL = 'invalid-bool'
@@ -80,6 +81,6 @@ def validate_path(value, base_path):
8081

8182

8283
def validate_string(value):
83-
if not isinstance(value, basestring):
84+
if not isinstance(value, string_types):
8485
raise ValidationError(value, INVALID_STRING)
85-
return unicode(value)
86+
return text_type(value)

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"recommonmark",
2424
"click>=4.0",
2525
"virtualenv",
26+
"six",
27+
"mock"
2628
],
2729
entry_points={
2830
'console_scripts': [

tox.ini

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
[tox]
22
envlist =
3-
py27-unittest,
4-
py27-integration
3+
py{27,34,35,36}-unittest,
4+
py{27,34,35,36}-integration
55
lint
66
# docs
77

8+
[tox:travis]
9+
2.7 = py27-unittest, py27-integration, lint
10+
3.4 = py34-unittest, py34-integration
11+
3.5 = py35-unittest, py35-integration
12+
3.6 = py36-unittest, py36-integration
13+
814
[testenv]
915
deps =
1016
-r{toxinidir}/requirements/tests.txt

0 commit comments

Comments
 (0)