Skip to content

Commit 6047a35

Browse files
committed
Apply black formatter to the codebase
1 parent c7002a4 commit 6047a35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1374
-1278
lines changed

docs/conf.py

Lines changed: 67 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,34 @@
1717

1818
import sys, os
1919

20-
sys.path.insert(0, os.path.abspath('..'))
20+
sys.path.insert(0, os.path.abspath(".."))
2121

2222
import pytest_bdd
2323

2424
# -- General configuration -----------------------------------------------------
2525

2626
# If your documentation needs a minimal Sphinx version, state it here.
27-
#needs_sphinx = '1.0'
27+
# needs_sphinx = '1.0'
2828

2929
# Add any Sphinx extension module names here, as strings. They can be extensions
3030
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
31-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
31+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
3232

3333
# Add any paths that contain templates here, relative to this directory.
34-
templates_path = ['_templates']
34+
templates_path = ["_templates"]
3535

3636
# The suffix of source filenames.
37-
source_suffix = '.rst'
37+
source_suffix = ".rst"
3838

3939
# The encoding of source files.
40-
#source_encoding = 'utf-8-sig'
40+
# source_encoding = 'utf-8-sig'
4141

4242
# The master toctree document.
43-
master_doc = 'index'
43+
master_doc = "index"
4444

4545
# General information about the project.
46-
project = u'Pytest-BDD'
47-
copyright = u'2013, Oleg Pidsadnyi'
46+
project = u"Pytest-BDD"
47+
copyright = u"2013, Oleg Pidsadnyi"
4848

4949
# The version info for the project you're documenting, acts as replacement for
5050
# |version| and |release|, also used in various other places throughout the
@@ -57,171 +57,163 @@
5757

5858
# The language for content autogenerated by Sphinx. Refer to documentation
5959
# for a list of supported languages.
60-
#language = None
60+
# language = None
6161

6262
# There are two options for replacing |today|: either, you set today to some
6363
# non-false value, then it is used:
64-
#today = ''
64+
# today = ''
6565
# Else, today_fmt is used as the format for a strftime call.
66-
#today_fmt = '%B %d, %Y'
66+
# today_fmt = '%B %d, %Y'
6767

6868
# List of patterns, relative to source directory, that match files and
6969
# directories to ignore when looking for source files.
70-
exclude_patterns = ['_build']
70+
exclude_patterns = ["_build"]
7171

7272
# The reST default role (used for this markup: `text`) to use for all documents.
73-
#default_role = None
73+
# default_role = None
7474

7575
# If true, '()' will be appended to :func: etc. cross-reference text.
76-
#add_function_parentheses = True
76+
# add_function_parentheses = True
7777

7878
# If true, the current module name will be prepended to all description
7979
# unit titles (such as .. function::).
80-
#add_module_names = True
80+
# add_module_names = True
8181

8282
# If true, sectionauthor and moduleauthor directives will be shown in the
8383
# output. They are ignored by default.
84-
#show_authors = False
84+
# show_authors = False
8585

8686
# The name of the Pygments (syntax highlighting) style to use.
87-
pygments_style = 'sphinx'
87+
pygments_style = "sphinx"
8888

8989
# A list of ignored prefixes for module index sorting.
90-
#modindex_common_prefix = []
90+
# modindex_common_prefix = []
9191

9292

9393
# -- Options for HTML output ---------------------------------------------------
9494

9595
# The theme to use for HTML and HTML Help pages. See the documentation for
9696
# a list of builtin themes.
97-
html_theme = 'default'
97+
html_theme = "default"
9898

9999
# Theme options are theme-specific and customize the look and feel of a theme
100100
# further. For a list of options available for each theme, see the
101101
# documentation.
102-
#html_theme_options = {}
102+
# html_theme_options = {}
103103

104104
# Add any paths that contain custom themes here, relative to this directory.
105-
#html_theme_path = []
105+
# html_theme_path = []
106106

107107
# The name for this set of Sphinx documents. If None, it defaults to
108108
# "<project> v<release> documentation".
109-
#html_title = None
109+
# html_title = None
110110

111111
# A shorter title for the navigation bar. Default is the same as html_title.
112-
#html_short_title = None
112+
# html_short_title = None
113113

114114
# The name of an image file (relative to this directory) to place at the top
115115
# of the sidebar.
116-
#html_logo = None
116+
# html_logo = None
117117

118118
# The name of an image file (within the static path) to use as favicon of the
119119
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
120120
# pixels large.
121-
#html_favicon = None
121+
# html_favicon = None
122122

123123
# Add any paths that contain custom static files (such as style sheets) here,
124124
# relative to this directory. They are copied after the builtin static files,
125125
# so a file named "default.css" will overwrite the builtin "default.css".
126-
html_static_path = ['_static']
126+
html_static_path = ["_static"]
127127

128128
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
129129
# using the given strftime format.
130-
#html_last_updated_fmt = '%b %d, %Y'
130+
# html_last_updated_fmt = '%b %d, %Y'
131131

132132
# If true, SmartyPants will be used to convert quotes and dashes to
133133
# typographically correct entities.
134-
#html_use_smartypants = True
134+
# html_use_smartypants = True
135135

136136
# Custom sidebar templates, maps document names to template names.
137-
#html_sidebars = {}
137+
# html_sidebars = {}
138138

139139
# Additional templates that should be rendered to pages, maps page names to
140140
# template names.
141-
#html_additional_pages = {}
141+
# html_additional_pages = {}
142142

143143
# If false, no module index is generated.
144-
#html_domain_indices = True
144+
# html_domain_indices = True
145145

146146
# If false, no index is generated.
147-
#html_use_index = True
147+
# html_use_index = True
148148

149149
# If true, the index is split into individual pages for each letter.
150-
#html_split_index = False
150+
# html_split_index = False
151151

152152
# If true, links to the reST sources are added to the pages.
153-
#html_show_sourcelink = True
153+
# html_show_sourcelink = True
154154

155155
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
156-
#html_show_sphinx = True
156+
# html_show_sphinx = True
157157

158158
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
159-
#html_show_copyright = True
159+
# html_show_copyright = True
160160

161161
# If true, an OpenSearch description file will be output, and all pages will
162162
# contain a <link> tag referring to it. The value of this option must be the
163163
# base URL from which the finished HTML is served.
164-
#html_use_opensearch = ''
164+
# html_use_opensearch = ''
165165

166166
# This is the file name suffix for HTML files (e.g. ".xhtml").
167-
#html_file_suffix = None
167+
# html_file_suffix = None
168168

169169
# Output file base name for HTML help builder.
170-
htmlhelp_basename = 'Pytest-BDDdoc'
170+
htmlhelp_basename = "Pytest-BDDdoc"
171171

172172

173173
# -- Options for LaTeX output --------------------------------------------------
174174

175175
latex_elements = {
176-
# The paper size ('letterpaper' or 'a4paper').
177-
#'papersize': 'letterpaper',
178-
179-
# The font size ('10pt', '11pt' or '12pt').
180-
#'pointsize': '10pt',
181-
182-
# Additional stuff for the LaTeX preamble.
183-
#'preamble': '',
176+
# The paper size ('letterpaper' or 'a4paper').
177+
#'papersize': 'letterpaper',
178+
# The font size ('10pt', '11pt' or '12pt').
179+
#'pointsize': '10pt',
180+
# Additional stuff for the LaTeX preamble.
181+
#'preamble': '',
184182
}
185183

186184
# Grouping the document tree into LaTeX files. List of tuples
187185
# (source start file, target name, title, author, documentclass [howto/manual]).
188-
latex_documents = [
189-
('index', 'Pytest-BDD.tex', u'Pytest-BDD Documentation',
190-
u'Oleg Pidsadnyi', 'manual'),
191-
]
186+
latex_documents = [("index", "Pytest-BDD.tex", u"Pytest-BDD Documentation", u"Oleg Pidsadnyi", "manual")]
192187

193188
# The name of an image file (relative to this directory) to place at the top of
194189
# the title page.
195-
#latex_logo = None
190+
# latex_logo = None
196191

197192
# For "manual" documents, if this is true, then toplevel headings are parts,
198193
# not chapters.
199-
#latex_use_parts = False
194+
# latex_use_parts = False
200195

201196
# If true, show page references after internal links.
202-
#latex_show_pagerefs = False
197+
# latex_show_pagerefs = False
203198

204199
# If true, show URL addresses after external links.
205-
#latex_show_urls = False
200+
# latex_show_urls = False
206201

207202
# Documents to append as an appendix to all manuals.
208-
#latex_appendices = []
203+
# latex_appendices = []
209204

210205
# If false, no module index is generated.
211-
#latex_domain_indices = True
206+
# latex_domain_indices = True
212207

213208

214209
# -- Options for manual page output --------------------------------------------
215210

216211
# One entry per manual page. List of tuples
217212
# (source start file, name, description, authors, manual section).
218-
man_pages = [
219-
('index', 'pytest-bdd', u'Pytest-BDD Documentation',
220-
[u'Oleg Pidsadnyi'], 1)
221-
]
213+
man_pages = [("index", "pytest-bdd", u"Pytest-BDD Documentation", [u"Oleg Pidsadnyi"], 1)]
222214

223215
# If true, show URL addresses after external links.
224-
#man_show_urls = False
216+
# man_show_urls = False
225217

226218

227219
# -- Options for Texinfo output ------------------------------------------------
@@ -230,16 +222,22 @@
230222
# (source start file, target name, title, author,
231223
# dir menu entry, description, category)
232224
texinfo_documents = [
233-
('index', 'Pytest-BDD', u'Pytest-BDD Documentation',
234-
u'Oleg Pidsadnyi', 'Pytest-BDD', 'One line description of project.',
235-
'Miscellaneous'),
225+
(
226+
"index",
227+
"Pytest-BDD",
228+
u"Pytest-BDD Documentation",
229+
u"Oleg Pidsadnyi",
230+
"Pytest-BDD",
231+
"One line description of project.",
232+
"Miscellaneous",
233+
)
236234
]
237235

238236
# Documents to append as an appendix to all manuals.
239-
#texinfo_appendices = []
237+
# texinfo_appendices = []
240238

241239
# If false, no module index is generated.
242-
#texinfo_domain_indices = True
240+
# texinfo_domain_indices = True
243241

244242
# How to display URL addresses: 'footnote', 'no', or 'inline'.
245-
#texinfo_show_urls = 'footnote'
243+
# texinfo_show_urls = 'footnote'

pytest_bdd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from pytest_bdd.steps import given, when, then
44
from pytest_bdd.scenario import scenario, scenarios
55

6-
__version__ = '3.2.1'
6+
__version__ = "3.2.1"
77

88
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__, scenarios.__name__]

pytest_bdd/cucumber_json.py

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,10 @@ def _get_result(self, step, report, error_message=False):
7777
if report.passed or not step["failed"]: # ignore setup/teardown
7878
result = {"status": "passed"}
7979
elif report.failed and step["failed"]:
80-
result = {
81-
"status": "failed",
82-
"error_message": force_unicode(report.longrepr) if error_message else "",
83-
}
80+
result = {"status": "failed", "error_message": force_unicode(report.longrepr) if error_message else ""}
8481
elif report.skipped:
8582
result = {"status": "skipped"}
86-
result['duration'] = long(math.floor((10 ** 9) * step["duration"])) # nanosec
83+
result["duration"] = long(math.floor((10 ** 9) * step["duration"])) # nanosec
8784
return result
8885

8986
def _serialize_tags(self, item):
@@ -98,17 +95,11 @@ def _serialize_tags(self, item):
9895
}
9996
]
10097
"""
101-
return [
102-
{
103-
"name": tag,
104-
"line": item["line_number"] - 1
105-
}
106-
for tag in item["tags"]
107-
]
98+
return [{"name": tag, "line": item["line_number"] - 1} for tag in item["tags"]]
10899

109100
def _format_name(self, name, keys, values):
110101
for param, value in zip(keys, values):
111-
name = name.replace('<{}>'.format(param), value)
102+
name = name.replace("<{}>".format(param), value)
112103
return name
113104

114105
def _format_step_name(self, report, step):
@@ -136,8 +127,8 @@ def pytest_runtest_logreport(self, report):
136127

137128
def stepmap(step):
138129
error_message = False
139-
if step['failed'] and not scenario.setdefault('failed', False):
140-
scenario['failed'] = True
130+
if step["failed"] and not scenario.setdefault("failed", False):
131+
scenario["failed"] = True
141132
error_message = True
142133

143134
if self.expand:
@@ -149,12 +140,10 @@ def stepmap(step):
149140
step_name = step["name"]
150141

151142
return {
152-
"keyword": step['keyword'],
143+
"keyword": step["keyword"],
153144
"name": step_name,
154-
"line": step['line_number'],
155-
"match": {
156-
"location": "",
157-
},
145+
"line": step["line_number"],
146+
"match": {"location": ""},
158147
"result": self._get_result(step, report, error_message),
159148
}
160149

@@ -164,22 +153,24 @@ def stepmap(step):
164153
"uri": scenario["feature"]["rel_filename"],
165154
"name": scenario["feature"]["name"] or scenario["feature"]["rel_filename"],
166155
"id": scenario["feature"]["rel_filename"].lower().replace(" ", "-"),
167-
"line": scenario['feature']["line_number"],
156+
"line": scenario["feature"]["line_number"],
168157
"description": scenario["feature"]["description"],
169158
"tags": self._serialize_tags(scenario["feature"]),
170159
"elements": [],
171160
}
172161

173-
self.features[scenario["feature"]["filename"]]["elements"].append({
174-
"keyword": "Scenario",
175-
"id": report.item["name"],
176-
"name": scenario["name"],
177-
"line": scenario["line_number"],
178-
"description": "",
179-
"tags": self._serialize_tags(scenario),
180-
"type": "scenario",
181-
"steps": [stepmap(step) for step in scenario["steps"]],
182-
})
162+
self.features[scenario["feature"]["filename"]]["elements"].append(
163+
{
164+
"keyword": "Scenario",
165+
"id": report.item["name"],
166+
"name": scenario["name"],
167+
"line": scenario["line_number"],
168+
"description": "",
169+
"tags": self._serialize_tags(scenario),
170+
"type": "scenario",
171+
"steps": [stepmap(step) for step in scenario["steps"]],
172+
}
173+
)
183174

184175
def pytest_sessionstart(self):
185176
self.suite_start_time = time.time()

0 commit comments

Comments
 (0)