Skip to content

Commit 52c8acd

Browse files
authored
pre commit config (pytest-dev#185)
* pre commit config * fixes by BLACK and badge in readme * Updates based on comments * Fix deprecation and add doc and test * Fix tests that fail locally * requested changes
1 parent 7f95997 commit 52c8acd

38 files changed

+1325
-1004
lines changed

Diff for: .pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/ambv/black
3+
rev: stable
4+
hooks:
5+
- id: black
6+
language_version: python3

Diff for: README.rst

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ support for running `Selenium <http://seleniumhq.org/>`_ based tests.
1616
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg
1717
:target: http://pytest-selenium.readthedocs.io/en/latest/
1818
:alt: Read the Docs
19+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
20+
:target: https://github.com/ambv/black
1921
.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-selenium.svg
2022
:target: https://github.com/pytest-dev/pytest-selenium/issues
2123
:alt: Issues

Diff for: docs/conf.py

+82-78
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,45 @@
1919
# If extensions (or modules to document with autodoc) are in another directory,
2020
# add these directories to sys.path here. If the directory is relative to the
2121
# documentation root, use os.path.abspath to make it absolute, like shown here.
22-
#sys.path.insert(0, os.path.abspath('.'))
22+
# sys.path.insert(0, os.path.abspath('.'))
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
3030
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3131
# ones.
32-
extensions = [
33-
'sphinx.ext.autodoc',
34-
'sphinx.ext.viewcode',
35-
]
32+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
3633

3734
# Add any paths that contain templates here, relative to this directory.
38-
templates_path = ['_templates']
35+
templates_path = ["_templates"]
3936

4037
# The suffix(es) of source filenames.
4138
# You can specify multiple suffix as a list of string:
4239
# source_suffix = ['.rst', '.md']
43-
source_suffix = '.rst'
40+
source_suffix = ".rst"
4441

4542
# The encoding of source files.
46-
#source_encoding = 'utf-8-sig'
43+
# source_encoding = 'utf-8-sig'
4744

4845
# The master toctree document.
49-
master_doc = 'index'
46+
master_doc = "index"
5047

5148
# General information about the project.
52-
project = u'pytest-selenium'
53-
copyright = u'2015, Dave Hunt'
54-
author = u'Dave Hunt'
49+
project = u"pytest-selenium"
50+
copyright = u"2015, Dave Hunt"
51+
author = u"Dave Hunt"
5552

5653
# The version info for the project you're documenting, acts as replacement for
5754
# |version| and |release|, also used in various other places throughout the
5855
# built documents.
5956
#
6057
# The short X.Y version.
61-
version = 'latest'
58+
version = "latest"
6259
# The full version, including alpha/beta/rc tags.
63-
release = 'latest'
60+
release = "latest"
6461

6562
# The language for content autogenerated by Sphinx. Refer to documentation
6663
# for a list of supported languages.
@@ -71,37 +68,37 @@
7168

7269
# There are two options for replacing |today|: either, you set today to some
7370
# non-false value, then it is used:
74-
#today = ''
71+
# today = ''
7572
# Else, today_fmt is used as the format for a strftime call.
76-
#today_fmt = '%B %d, %Y'
73+
# today_fmt = '%B %d, %Y'
7774

7875
# List of patterns, relative to source directory, that match files and
7976
# directories to ignore when looking for source files.
80-
exclude_patterns = ['_build']
77+
exclude_patterns = ["_build"]
8178

8279
# The reST default role (used for this markup: `text`) to use for all
8380
# documents.
84-
#default_role = None
81+
# default_role = None
8582

8683
# If true, '()' will be appended to :func: etc. cross-reference text.
87-
#add_function_parentheses = True
84+
# add_function_parentheses = True
8885

8986
# If true, the current module name will be prepended to all description
9087
# unit titles (such as .. function::).
91-
#add_module_names = True
88+
# add_module_names = True
9289

9390
# If true, sectionauthor and moduleauthor directives will be shown in the
9491
# output. They are ignored by default.
95-
#show_authors = False
92+
# show_authors = False
9693

9794
# The name of the Pygments (syntax highlighting) style to use.
98-
pygments_style = 'sphinx'
95+
pygments_style = "sphinx"
9996

10097
# A list of ignored prefixes for module index sorting.
101-
#modindex_common_prefix = []
98+
# modindex_common_prefix = []
10299

103100
# If true, keep warnings as "system message" paragraphs in the built documents.
104-
#keep_warnings = False
101+
# keep_warnings = False
105102

106103
# If true, `todo` and `todoList` produce output, else they produce nothing.
107104
todo_include_todos = False
@@ -111,31 +108,31 @@
111108

112109
# The theme to use for HTML and HTML Help pages. See the documentation for
113110
# a list of builtin themes.
114-
html_theme = 'default'
111+
html_theme = "default"
115112

116113
# Theme options are theme-specific and customize the look and feel of a theme
117114
# further. For a list of options available for each theme, see the
118115
# documentation.
119-
#html_theme_options = {}
116+
# html_theme_options = {}
120117

121118
# Add any paths that contain custom themes here, relative to this directory.
122-
#html_theme_path = []
119+
# html_theme_path = []
123120

124121
# The name for this set of Sphinx documents. If None, it defaults to
125122
# "<project> v<release> documentation".
126-
#html_title = None
123+
# html_title = None
127124

128125
# A shorter title for the navigation bar. Default is the same as html_title.
129-
#html_short_title = None
126+
# html_short_title = None
130127

131128
# The name of an image file (relative to this directory) to place at the top
132129
# of the sidebar.
133-
#html_logo = None
130+
# html_logo = None
134131

135132
# The name of an image file (within the static path) to use as favicon of the
136133
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
137134
# pixels large.
138-
#html_favicon = None
135+
# html_favicon = None
139136

140137
# Add any paths that contain custom static files (such as style sheets) here,
141138
# relative to this directory. They are copied after the builtin static files,
@@ -145,122 +142,123 @@
145142
# Add any extra paths that contain custom files (such as robots.txt or
146143
# .htaccess) here, relative to this directory. These files are copied
147144
# directly to the root of the documentation.
148-
#html_extra_path = []
145+
# html_extra_path = []
149146

150147
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
151148
# using the given strftime format.
152-
#html_last_updated_fmt = '%b %d, %Y'
149+
# html_last_updated_fmt = '%b %d, %Y'
153150

154151
# If true, SmartyPants will be used to convert quotes and dashes to
155152
# typographically correct entities.
156-
#html_use_smartypants = True
153+
# html_use_smartypants = True
157154

158155
# Custom sidebar templates, maps document names to template names.
159-
#html_sidebars = {}
156+
# html_sidebars = {}
160157

161158
# Additional templates that should be rendered to pages, maps page names to
162159
# template names.
163-
#html_additional_pages = {}
160+
# html_additional_pages = {}
164161

165162
# If false, no module index is generated.
166-
#html_domain_indices = True
163+
# html_domain_indices = True
167164

168165
# If false, no index is generated.
169-
#html_use_index = True
166+
# html_use_index = True
170167

171168
# If true, the index is split into individual pages for each letter.
172-
#html_split_index = False
169+
# html_split_index = False
173170

174171
# If true, links to the reST sources are added to the pages.
175-
#html_show_sourcelink = True
172+
# html_show_sourcelink = True
176173

177174
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
178-
#html_show_sphinx = True
175+
# html_show_sphinx = True
179176

180177
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
181-
#html_show_copyright = True
178+
# html_show_copyright = True
182179

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

188185
# This is the file name suffix for HTML files (e.g. ".xhtml").
189-
#html_file_suffix = None
186+
# html_file_suffix = None
190187

191188
# Language to be used for generating the HTML full-text search index.
192189
# Sphinx supports the following languages:
193190
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
194191
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
195-
#html_search_language = 'en'
192+
# html_search_language = 'en'
196193

197194
# A dictionary with options for the search language support, empty by default.
198195
# Now only 'ja' uses this config value
199-
#html_search_options = {'type': 'default'}
196+
# html_search_options = {'type': 'default'}
200197

201198
# The name of a javascript file (relative to the configuration directory) that
202199
# implements a search results scorer. If empty, the default will be used.
203-
#html_search_scorer = 'scorer.js'
200+
# html_search_scorer = 'scorer.js'
204201

205202
# Output file base name for HTML help builder.
206-
htmlhelp_basename = 'pytest-seleniumdoc'
203+
htmlhelp_basename = "pytest-seleniumdoc"
207204

208205
# -- Options for LaTeX output ---------------------------------------------
209206

210207
latex_elements = {
211-
# The paper size ('letterpaper' or 'a4paper').
212-
#'papersize': 'letterpaper',
213-
214-
# The font size ('10pt', '11pt' or '12pt').
215-
#'pointsize': '10pt',
216-
217-
# Additional stuff for the LaTeX preamble.
218-
#'preamble': '',
219-
220-
# Latex figure (float) alignment
221-
#'figure_align': 'htbp',
208+
# The paper size ('letterpaper' or 'a4paper').
209+
# 'papersize': 'letterpaper',
210+
# The font size ('10pt', '11pt' or '12pt').
211+
# 'pointsize': '10pt',
212+
# Additional stuff for the LaTeX preamble.
213+
# 'preamble': '',
214+
# Latex figure (float) alignment
215+
# 'figure_align': 'htbp',
222216
}
223217

224218
# Grouping the document tree into LaTeX files. List of tuples
225219
# (source start file, target name, title,
226220
# author, documentclass [howto, manual, or own class]).
227221
latex_documents = [
228-
(master_doc, 'pytest-selenium.tex', u'pytest-selenium Documentation',
229-
u'Dave Hunt', 'manual'),
222+
(
223+
master_doc,
224+
"pytest-selenium.tex",
225+
u"pytest-selenium Documentation",
226+
u"Dave Hunt",
227+
"manual",
228+
)
230229
]
231230

232231
# The name of an image file (relative to this directory) to place at the top of
233232
# the title page.
234-
#latex_logo = None
233+
# latex_logo = None
235234

236235
# For "manual" documents, if this is true, then toplevel headings are parts,
237236
# not chapters.
238-
#latex_use_parts = False
237+
# latex_use_parts = False
239238

240239
# If true, show page references after internal links.
241-
#latex_show_pagerefs = False
240+
# latex_show_pagerefs = False
242241

243242
# If true, show URL addresses after external links.
244-
#latex_show_urls = False
243+
# latex_show_urls = False
245244

246245
# Documents to append as an appendix to all manuals.
247-
#latex_appendices = []
246+
# latex_appendices = []
248247

249248
# If false, no module index is generated.
250-
#latex_domain_indices = True
249+
# latex_domain_indices = True
251250

252251

253252
# -- Options for manual page output ---------------------------------------
254253

255254
# One entry per manual page. List of tuples
256255
# (source start file, name, description, authors, manual section).
257256
man_pages = [
258-
(master_doc, 'pytest-selenium', u'pytest-selenium Documentation',
259-
[author], 1)
257+
(master_doc, "pytest-selenium", u"pytest-selenium Documentation", [author], 1)
260258
]
261259

262260
# If true, show URL addresses after external links.
263-
#man_show_urls = False
261+
# man_show_urls = False
264262

265263

266264
# -- Options for Texinfo output -------------------------------------------
@@ -269,19 +267,25 @@
269267
# (source start file, target name, title, author,
270268
# dir menu entry, description, category)
271269
texinfo_documents = [
272-
(master_doc, 'pytest-selenium', u'pytest-selenium Documentation',
273-
author, 'pytest-selenium', 'One line description of project.',
274-
'Miscellaneous'),
270+
(
271+
master_doc,
272+
"pytest-selenium",
273+
u"pytest-selenium Documentation",
274+
author,
275+
"pytest-selenium",
276+
"One line description of project.",
277+
"Miscellaneous",
278+
)
275279
]
276280

277281
# Documents to append as an appendix to all manuals.
278-
#texinfo_appendices = []
282+
# texinfo_appendices = []
279283

280284
# If false, no module index is generated.
281-
#texinfo_domain_indices = True
285+
# texinfo_domain_indices = True
282286

283287
# How to display URL addresses: 'footnote', 'no', or 'inline'.
284-
#texinfo_show_urls = 'footnote'
288+
# texinfo_show_urls = 'footnote'
285289

286290
# If true, do not generate a @detailmenu in the "Top" node's menu.
287-
#texinfo_no_detailmenu = False
291+
# texinfo_no_detailmenu = False

Diff for: docs/user_guide.rst

+10
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ preferences, and a command line argument:
136136
See the `Firefox options API documentation`_ for full details of what can be
137137
configured.
138138

139+
You can also use the ``firefox_preferences`` and ``firefox_arguments`` markers:
140+
141+
.. code-block:: python
142+
143+
import pytest
144+
@pytest.mark.firefox_arguments('-foreground')
145+
@pytest.mark.firefox_preferences({'browser.anchor_color': '#FF0000'})
146+
def test_firefox(selenium):
147+
selenium.get('http://www.example.com')
148+
139149
Chrome
140150
------
141151

0 commit comments

Comments
 (0)