From dff2d2b21fd5d40ebcdcf9481c48f705c72950cd Mon Sep 17 00:00:00 2001 From: jyhl Date: Wed, 29 Apr 2020 16:58:25 +0800 Subject: [PATCH] add nox --- noxfile.py | 17 +++++++++++++++++ src/__init__.py | 0 src/demo.py | 2 +- tests/__init__.py | 0 tests/test_demo.py | 6 ++++++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 noxfile.py create mode 100644 src/__init__.py create mode 100644 tests/__init__.py create mode 100644 tests/test_demo.py diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..2fc7722 --- /dev/null +++ b/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") diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/demo.py b/src/demo.py index f128f9b..89cc7c6 100644 --- a/src/demo.py +++ b/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) driver = webdriver.Chrome( os.path.join(path, 'chromedriver'), - chrome_options=chrome_options) + options=chrome_options) return driver diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_demo.py b/tests/test_demo.py new file mode 100644 index 0000000..fcc10b1 --- /dev/null +++ b/tests/test_demo.py @@ -0,0 +1,6 @@ +import pytest +from src.demo import get_chromedriver + + +def test_demo(): + get_chromedriver(True)