Skip to content

Commit 8e96c6e

Browse files
authored
Migrate to 'black' for consistent styling and formatting (#218)
* Migrate to 'black' for consistent styling and formatting * Add black to tox and travis
1 parent c9eadb0 commit 8e96c6e

File tree

9 files changed

+723
-511
lines changed

9 files changed

+723
-511
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ local.properties
3131
##Tests JS
3232
node_modules/
3333

34-
Pipfile
34+
Pipfile.lock

.travis.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,68 @@
11
language: python
22
jobs:
33
include:
4-
- stage:
4+
- stage: tests
55
language: node_js
66
node_js: node
77
install: npm install phantomjs-prebuilt@2.1.15 grunt-cli grunt grunt-contrib-qunit
88
script: grunt test
9-
- stage:
9+
10+
-
1011
python: 3.7
1112
dist: xenial
1213
sudo: required
1314
env: TOXENV=flake8
14-
- stage:
15+
16+
-
17+
python: 3.7
18+
dist: xenial
19+
sudo: required
20+
env: TOXENV=black
21+
22+
-
1523
python: 2.7
1624
env: TOXENV=py27
17-
- stage:
25+
26+
-
1827
python: 2.7
1928
env: TOXENV=py27-ansi2html
20-
- stage:
29+
30+
-
2131
python: 3.6
2232
env: TOXENV=py36
23-
- stage:
33+
34+
-
2435
python: 3.6
2536
env: TOXENV=py36-ansi2html
26-
- stage:
37+
38+
-
2739
python: 3.7
2840
dist: xenial
2941
sudo: required
3042
env: TOXENV=py37
31-
- stage:
43+
44+
-
3245
python: 3.7
3346
dist: xenial
3447
sudo: required
3548
env: TOXENV=py37-ansi2html
36-
- stage:
49+
50+
-
3751
python: pypy
3852
env: TOXENV=pypy
39-
- stage:
53+
54+
-
4055
python: pypy
4156
env: TOXENV=pypy-ansi2html
42-
- stage:
57+
58+
-
4359
python: pypy3
4460
env: TOXENV=pypy3
45-
- stage:
61+
62+
-
4663
python: pypy3
4764
env: TOXENV=pypy3-ansi2html
65+
4866
- stage: deploy
4967
python: 3.7
5068
dist: xenial
@@ -60,7 +78,9 @@ jobs:
6078
on:
6179
tags: true
6280
repo: pytest-dev/pytest-html
63-
cache:
64-
pip: true
81+
82+
cache: pip
83+
6584
install: pip install tox
85+
6686
script: tox

Pipfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
pytest = "*"
8+
tox = "*"
9+
flake8 = "*"
10+
black = "*"
11+
12+
[packages]
13+
pytest-html = {editable = true,path = "."}

pytest_html/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
__version__ = get_distribution(__name__).version
66
except DistributionNotFound:
77
# package is not installed
8-
__version__ = 'unknown'
8+
__version__ = "unknown"
99

10-
__pypi_url__ = 'https://pypi.python.org/pypi/pytest-html'
10+
__pypi_url__ = "https://pypi.python.org/pypi/pytest-html"

pytest_html/extras.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,50 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5-
FORMAT_HTML = 'html'
6-
FORMAT_IMAGE = 'image'
7-
FORMAT_JSON = 'json'
8-
FORMAT_TEXT = 'text'
9-
FORMAT_URL = 'url'
5+
FORMAT_HTML = "html"
6+
FORMAT_IMAGE = "image"
7+
FORMAT_JSON = "json"
8+
FORMAT_TEXT = "text"
9+
FORMAT_URL = "url"
1010

1111

1212
def extra(content, format, name=None, mime_type=None, extension=None):
13-
return {'name': name, 'format': format, 'content': content,
14-
'mime_type': mime_type, 'extension': extension}
13+
return {
14+
"name": name,
15+
"format": format,
16+
"content": content,
17+
"mime_type": mime_type,
18+
"extension": extension,
19+
}
1520

1621

1722
def html(content):
1823
return extra(content, FORMAT_HTML)
1924

2025

21-
def image(content, name='Image', mime_type='image/png', extension='png'):
26+
def image(content, name="Image", mime_type="image/png", extension="png"):
2227
return extra(content, FORMAT_IMAGE, name, mime_type, extension)
2328

2429

25-
def png(content, name='Image'):
26-
return image(content, name, mime_type='image/png', extension='png')
30+
def png(content, name="Image"):
31+
return image(content, name, mime_type="image/png", extension="png")
2732

2833

29-
def jpg(content, name='Image'):
30-
return image(content, name, mime_type='image/jpeg', extension='jpg')
34+
def jpg(content, name="Image"):
35+
return image(content, name, mime_type="image/jpeg", extension="jpg")
3136

3237

33-
def svg(content, name='Image'):
34-
return image(content, name, mime_type='image/svg+xml', extension='svg')
38+
def svg(content, name="Image"):
39+
return image(content, name, mime_type="image/svg+xml", extension="svg")
3540

3641

37-
def json(content, name='JSON'):
38-
return extra(content, FORMAT_JSON, name, 'application/json', 'json')
42+
def json(content, name="JSON"):
43+
return extra(content, FORMAT_JSON, name, "application/json", "json")
3944

4045

41-
def text(content, name='Text'):
42-
return extra(content, FORMAT_TEXT, name, 'text/plain', 'txt')
46+
def text(content, name="Text"):
47+
return extra(content, FORMAT_TEXT, name, "text/plain", "txt")
4348

4449

45-
def url(content, name='URL'):
50+
def url(content, name="URL"):
4651
return extra(content, FORMAT_URL, name)

0 commit comments

Comments
 (0)