Browse Source

add nox

master
jyhl 5 years ago
parent
commit
dff2d2b21f
  1. 17
      noxfile.py
  2. 0
      src/__init__.py
  3. 2
      src/demo.py
  4. 0
      tests/__init__.py
  5. 6
      tests/test_demo.py

17
noxfile.py

@ -0,0 +1,17 @@
import nox
@nox.session
def lint(session):
session.install("flake8")
session.run("flake8", "demo.py")
@nox.session(python=["2.7", "3.6"])
def tests(session):
# same as pip install -r -requirements.txt
session.install("-r", "requirements.txt")
session.install("pytest")
session.run("pytest","-v","tests")

0
src/__init__.py

2
src/demo.py

@ -87,7 +87,7 @@ def get_chromedriver(use_proxy=False, user_agent=None):
chrome_options.add_argument('--user-agent=%s' % user_agent) chrome_options.add_argument('--user-agent=%s' % user_agent)
driver = webdriver.Chrome( driver = webdriver.Chrome(
os.path.join(path, 'chromedriver'), os.path.join(path, 'chromedriver'),
chrome_options=chrome_options) options=chrome_options)
return driver return driver

0
tests/__init__.py

6
tests/test_demo.py

@ -0,0 +1,6 @@
import pytest
from src.demo import get_chromedriver
def test_demo():
get_chromedriver(True)
Loading…
Cancel
Save