Skip to content

Commit

Permalink
Blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Feb 1, 2019
1 parent 576546a commit 080af20
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

python3.6 -m pip install nox
python3.6 -m nox -s lint tests system_tests cover
python3.6 -m nox
84 changes: 49 additions & 35 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
import nox


@nox.session(python='2.7')
@nox.session(python="3.6")
def cover(session):
session.install('pytest', 'mock', 'coverage', 'pytest-cov')
session.install('.')
session.run('py.test', '--quiet', '--cov=google.cloud.happybase', '--cov=unit_tests', '--cov-config', '.coveragerc', 'unit_tests')
session.install("pytest", "mock", "coverage", "pytest-cov")
session.install(".")
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.happybase",
"--cov=unit_tests",
"--cov-config",
".coveragerc",
"unit_tests",
)

@nox.session(python='2.7')

@nox.session(python="3.6")
def docs(session):
session.install('pytest', 'mock', 'Sphinx', 'sphinx_rtd_theme')
session.install('.')
session.run('python', '-c', "import shutil; shutil.rmtree('docs/_build', ignore_errors=True)")
session.run('sphinx-build', '-W', '-b', 'html', '-d', 'docs/_build/doctrees', 'docs', 'docs/_build/html')
session.run('python', 'scripts/verify_included_modules.py', '--build-root', '_build')
session.install("pytest", "mock", "Sphinx", "sphinx_rtd_theme")
session.install(".")
session.run(
"python",
"-c",
"import shutil; shutil.rmtree('docs/_build', ignore_errors=True)",
)
session.run(
"sphinx-build",
"-W",
"-b",
"html",
"-d",
"docs/_build/doctrees",
"docs",
"docs/_build/html",
)
session.run(
"python", "scripts/verify_included_modules.py", "--build-root", "_build"
)


@nox.session(python="3.7")
def lint(session):
Expand All @@ -22,36 +47,25 @@ def lint(session):
serious code quality issues.
"""
session.install("flake8", "black")
session.run(
"black",
"--check",
"src",
"docs",
"unit_tests",
"system_tests"
)
session.run("black", "--check", "src", "docs", "unit_tests", "system_tests")
session.run("flake8", "google", "tests")

@nox.session(python='3.6')

@nox.session(python="3.6")
def blacken(session):
session.install("black")
session.run(
"black",
"noxfile.py"
"src",
"docs",
"unit_tests",
"system_tests",
)
session.run("black", "noxfile.py" "src", "docs", "unit_tests", "system_tests")

@nox.session(python=['2.7', '3.4', '3.5'])

@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7"])
def tests(session):
session.install('pytest', 'mock')
session.install('.')
session.run('py.test', '--quiet', 'unit_tests')
session.install("pytest", "mock")
session.install(".")
session.run("py.test", "--quiet", "unit_tests")


@nox.session(python=['2.7', '3.4'])
@nox.session(python=["2.7", "3.4", "3.5", "3.6", "3.7"])
def system_tests(session):
session.install('pytest', 'mock')
session.install('.')
session.run('python', 'system_tests/attempt_system_tests.py')
session.install("pytest", "mock")
session.install(".")
session.run("python", "system_tests/attempt_system_tests.py")
12 changes: 6 additions & 6 deletions system_tests/happybase.py → system_tests/test_happybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,22 +655,22 @@ def test_put_with_timestamp(self):
self.assertEqual(row1, row1_data_with_timestamps)

def test_put_not_encoded_value(self):
value1 = 'hello world!'
col1 = (COL_FAM1 + ':greetings').encode('utf-8')
value1 = "hello world!"
col1 = (COL_FAM1 + ":greetings").encode("utf-8")
row1_data = {col1: value1}

# Need to clean-up row1 after, in case it doesn't fail.
self.rows_to_delete.append(ROW_KEY1)
with self.assertRaises(ValueError):
Config.TABLE.put(ROW_KEY1, row1_data)

def test_put_not_encoded_column_family(self):
value1 = 'hello world!'.encode('utf-8')
col1 = 'col1:greetings'
value1 = "hello world!".encode("utf-8")
col1 = "col1:greetings"
row1_data = {col1: value1}
# Need to clean-up row1 after, in case it doesn't fail.
self.rows_to_delete.append(ROW_KEY1)

with self.assertRaises(ValueError):
Config.TABLE.put(ROW_KEY1, row1_data)

Expand Down

0 comments on commit 080af20

Please sign in to comment.