Skip to content

Commit 8b7f8fd

Browse files
authored
Use latest version of Nox for tests. (#222)
* Use latest version of Nox for tests. Also, update lint session to use black to check. * Use plain pytest for Python 2.7
1 parent 7cbdf22 commit 8b7f8fd

File tree

6 files changed

+379
-249
lines changed

6 files changed

+379
-249
lines changed

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ matrix:
44
include:
55
- os: linux
66
python: 2.7
7-
env: PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='true'
7+
env: PYTHON=2.7 PANDAS=0.19.2 COVERAGE='false' LINT='false'
88
- os: linux
99
python: 3.5
1010
env: PYTHON=3.5 PANDAS=0.18.1 COVERAGE='true' LINT='false'
@@ -28,7 +28,7 @@ install:
2828
- pip install --upgrade pip
2929
- REQ="ci/requirements-${PYTHON}-${PANDAS}" ;
3030
if [ -f "$REQ.pip" ]; then
31-
pip install --upgrade nox-automation ;
31+
pip install --upgrade nox ;
3232
else
3333
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
3434
bash miniconda.sh -b -p $HOME/miniconda ;
@@ -49,9 +49,13 @@ install:
4949
fi
5050

5151
script:
52-
- if [[ $PYTHON == '2.7' ]]; then nox -s test27 ; fi
53-
- if [[ $PYTHON == '3.5' ]]; then nox -s test35 ; fi
54-
- if [[ $PYTHON == '3.6' ]] && [[ "$PANDAS" == "MASTER" ]]; then nox -s test36master ; fi
52+
- if [[ $PYTHON == '2.7' ]]; then
53+
pip install -r ci/requirements-2.7-0.19.2.pip ;
54+
pip install -e . ;
55+
pytest tests/unit ;
56+
fi
57+
- if [[ $PYTHON == '3.5' ]]; then nox -s test_earliest_deps ; fi
58+
- if [[ $PYTHON == '3.6' ]] && [[ "$PANDAS" == "MASTER" ]]; then nox -s test_latest_deps ; fi
5559
- REQ="ci/requirements-${PYTHON}-${PANDAS}" ;
5660
if [ -f "$REQ.conda" ]; then
5761
pytest --quiet -m 'not local_auth' -v tests ;

ci/requirements-3.5-0.18.1.pip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
google-auth==1.4.1
22
google-auth-oauthlib==0.0.1
33
google-cloud-bigquery==0.32.0
4+
pandas==0.18.1

docs/source/conf.py

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,49 @@
3030
# Add any Sphinx extension module names here, as strings. They can be
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3232
# ones.
33-
extensions = ['sphinx.ext.autodoc',
34-
'sphinx.ext.autosummary',
35-
'sphinx.ext.doctest',
36-
'sphinx.ext.extlinks',
37-
'sphinx.ext.todo',
38-
'numpydoc', # used to parse numpy-style docstrings for autodoc
39-
'IPython.sphinxext.ipython_console_highlighting',
40-
'IPython.sphinxext.ipython_directive',
41-
'sphinx.ext.intersphinx',
42-
'sphinx.ext.coverage',
43-
'sphinx.ext.ifconfig',
44-
]
33+
extensions = [
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.autosummary",
36+
"sphinx.ext.doctest",
37+
"sphinx.ext.extlinks",
38+
"sphinx.ext.todo",
39+
"numpydoc", # used to parse numpy-style docstrings for autodoc
40+
"IPython.sphinxext.ipython_console_highlighting",
41+
"IPython.sphinxext.ipython_directive",
42+
"sphinx.ext.intersphinx",
43+
"sphinx.ext.coverage",
44+
"sphinx.ext.ifconfig",
45+
]
4546

4647
# Add any paths that contain templates here, relative to this directory.
47-
templates_path = ['_templates']
48+
templates_path = ["_templates"]
4849

4950
# The suffix(es) of source filenames.
5051
# You can specify multiple suffix as a list of string:
5152
#
5253
# source_suffix = ['.rst', '.md']
53-
source_suffix = '.rst'
54+
source_suffix = ".rst"
5455

5556
# The encoding of source files.
5657
#
5758
# source_encoding = 'utf-8-sig'
5859

5960
# The master toctree document.
60-
master_doc = 'index'
61+
master_doc = "index"
6162

6263
# General information about the project.
63-
project = u'pandas-gbq'
64-
copyright = u'2017, PyData Development Team'
65-
author = u'PyData Development Team'
64+
project = u"pandas-gbq"
65+
copyright = u"2017, PyData Development Team"
66+
author = u"PyData Development Team"
6667

6768
# The version info for the project you're documenting, acts as replacement for
6869
# |version| and |release|, also used in various other places throughout the
6970
# built documents.
7071
#
7172
# The short X.Y version.
72-
version = u'0.1.0'
73+
version = u"0.1.0"
7374
# The full version, including alpha/beta/rc tags.
74-
release = u'0.1.0'
75+
release = u"0.1.0"
7576

7677
# The language for content autogenerated by Sphinx. Refer to documentation
7778
# for a list of supported languages.
@@ -92,7 +93,7 @@
9293
# List of patterns, relative to source directory, that match files and
9394
# directories to ignore when looking for source files.
9495
# This patterns also effect to html_static_path and html_extra_path
95-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
96+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
9697

9798
# The reST default role (used for this markup: `text`) to use for all
9899
# documents.
@@ -114,7 +115,7 @@
114115
# show_authors = False
115116

116117
# The name of the Pygments (syntax highlighting) style to use.
117-
pygments_style = 'sphinx'
118+
pygments_style = "sphinx"
118119

119120
# A list of ignored prefixes for module index sorting.
120121
# modindex_common_prefix = []
@@ -130,11 +131,12 @@
130131

131132
# Taken from docs.readthedocs.io:
132133
# on_rtd is whether we are on readthedocs.io
133-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
134+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
134135

135136
if not on_rtd: # only import and set the theme if we're building docs locally
136137
import sphinx_rtd_theme
137-
html_theme = 'sphinx_rtd_theme'
138+
139+
html_theme = "sphinx_rtd_theme"
138140
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
139141

140142
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -174,7 +176,7 @@
174176
# Add any paths that contain custom static files (such as style sheets) here,
175177
# relative to this directory. They are copied after the builtin static files,
176178
# so a file named "default.css" will overwrite the builtin "default.css".
177-
html_static_path = ['_static']
179+
html_static_path = ["_static"]
178180

179181
# Add any extra paths that contain custom files (such as robots.txt or
180182
# .htaccess) here, relative to this directory. These files are copied
@@ -254,34 +256,36 @@
254256
# html_search_scorer = 'scorer.js'
255257

256258
# Output file base name for HTML help builder.
257-
htmlhelp_basename = 'pandas-gbqdoc'
259+
htmlhelp_basename = "pandas-gbqdoc"
258260

259261
# -- Options for LaTeX output ---------------------------------------------
260262

261263
latex_elements = {
262-
# The paper size ('letterpaper' or 'a4paper').
263-
#
264-
# 'papersize': 'letterpaper',
265-
266-
# The font size ('10pt', '11pt' or '12pt').
267-
#
268-
# 'pointsize': '10pt',
269-
270-
# Additional stuff for the LaTeX preamble.
271-
#
272-
# 'preamble': '',
273-
274-
# Latex figure (float) alignment
275-
#
276-
# 'figure_align': 'htbp',
264+
# The paper size ('letterpaper' or 'a4paper').
265+
#
266+
# 'papersize': 'letterpaper',
267+
# The font size ('10pt', '11pt' or '12pt').
268+
#
269+
# 'pointsize': '10pt',
270+
# Additional stuff for the LaTeX preamble.
271+
#
272+
# 'preamble': '',
273+
# Latex figure (float) alignment
274+
#
275+
# 'figure_align': 'htbp',
277276
}
278277

279278
# Grouping the document tree into LaTeX files. List of tuples
280279
# (source start file, target name, title,
281280
# author, documentclass [howto, manual, or own class]).
282281
latex_documents = [
283-
(master_doc, 'pandas-gbq.tex', u'pandas-gbq Documentation',
284-
u'PyData Development Team', 'manual'),
282+
(
283+
master_doc,
284+
"pandas-gbq.tex",
285+
u"pandas-gbq Documentation",
286+
u"PyData Development Team",
287+
"manual",
288+
)
285289
]
286290

287291
# The name of an image file (relative to this directory) to place at the top of
@@ -322,8 +326,7 @@
322326
# One entry per manual page. List of tuples
323327
# (source start file, name, description, authors, manual section).
324328
man_pages = [
325-
(master_doc, 'pandas-gbq', u'pandas-gbq Documentation',
326-
[author], 1)
329+
(master_doc, "pandas-gbq", u"pandas-gbq Documentation", [author], 1)
327330
]
328331

329332
# If true, show URL addresses after external links.
@@ -337,9 +340,15 @@
337340
# (source start file, target name, title, author,
338341
# dir menu entry, description, category)
339342
texinfo_documents = [
340-
(master_doc, 'pandas-gbq', u'pandas-gbq Documentation',
341-
author, 'pandas-gbq', 'One line description of project.',
342-
'Miscellaneous'),
343+
(
344+
master_doc,
345+
"pandas-gbq",
346+
u"pandas-gbq Documentation",
347+
author,
348+
"pandas-gbq",
349+
"One line description of project.",
350+
"Miscellaneous",
351+
)
343352
]
344353

345354
# Documents to append as an appendix to all manuals.
@@ -361,11 +370,12 @@
361370

362371
# Configuration for intersphinx:
363372
intersphinx_mapping = {
364-
'https://docs.python.org/': None,
365-
'https://pandas.pydata.org/pandas-docs/stable/': None,
366-
'https://google-auth.readthedocs.io/en/latest/': None,
373+
"https://docs.python.org/": None,
374+
"https://pandas.pydata.org/pandas-docs/stable/": None,
375+
"https://google-auth.readthedocs.io/en/latest/": None,
367376
}
368377

369-
extlinks = {'issue': ('https://github.com/pydata/pandas-gbq/issues/%s',
370-
'GH#'),
371-
'pr': ('https://github.com/pydata/pandas-gbq/pull/%s', 'GH#')}
378+
extlinks = {
379+
"issue": ("https://github.com/pydata/pandas-gbq/issues/%s", "GH#"),
380+
"pr": ("https://github.com/pydata/pandas-gbq/pull/%s", "GH#"),
381+
}

nox.py renamed to noxfile.py

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
)
1515

1616

17+
latest_python = "3.6"
18+
19+
1720
@nox.session
18-
def default(session):
21+
def test(session):
1922
session.install("mock", "pytest", "pytest-cov")
2023
session.install("-e", ".")
2124

@@ -53,54 +56,38 @@ def unit(session):
5356

5457

5558
@nox.session
56-
def test27(session):
57-
session.interpreter = "python2.7"
58-
session.install(
59-
"-r", os.path.join(".", "ci", "requirements-2.7-0.19.2.pip")
60-
)
61-
default(session)
62-
63-
64-
@nox.session
65-
def test35(session):
66-
session.interpreter = "python3.5"
59+
def test_earliest_deps(session, python="3.5"):
6760
session.install(
6861
"-r", os.path.join(".", "ci", "requirements-3.5-0.18.1.pip")
6962
)
70-
default(session)
63+
test(session)
7164

7265

7366
@nox.session
74-
def test36(session):
75-
session.interpreter = "python3.6"
76-
session.install(
77-
"-r", os.path.join(".", "ci", "requirements-3.6-0.20.1.conda")
78-
)
79-
default(session)
80-
81-
82-
@nox.session
83-
def test36master(session):
84-
session.interpreter = "python3.6"
67+
def test_latest_deps(session, python=latest_python):
8568
session.install(
8669
"--pre", "--upgrade", "--timeout=60", "-f", PANDAS_PRE_WHEELS, "pandas"
8770
)
8871
session.install(
8972
"-r", os.path.join(".", "ci", "requirements-3.6-MASTER.pip")
9073
)
91-
default(session)
74+
test(session)
9275

9376

9477
@nox.session
95-
def lint(session):
96-
session.install("flake8")
97-
session.run("flake8", "pandas_gbq", "tests", "-v")
78+
def lint(session, python=latest_python):
79+
session.install("black")
80+
session.run(
81+
"black",
82+
"--check",
83+
"--exclude",
84+
"(\.git|\.hg|\.mypy_cache|\.tox|\.nox|\.venv|_build|buck-out|build|dist)",
85+
".",
86+
)
9887

9988

10089
@nox.session
101-
def cover(session):
102-
session.interpreter = "python3.5"
103-
90+
def cover(session, python=latest_python):
10491
session.install("coverage", "pytest-cov")
10592
session.run("coverage", "report", "--show-missing", "--fail-under=40")
10693
session.run("coverage", "erase")

0 commit comments

Comments
 (0)