From 00db2a4be1e326585db8e5f9b964ba8ba2cfa6a8 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Mon, 15 Oct 2018 17:04:54 +0200 Subject: [PATCH 1/3] Ability to run pure python tests --- .circleci/config.yml | 13 +++++++++++++ test/{ => packages}/test_numpy.py | 0 test/{ => packages}/test_pandas.py | 0 test/src/test_pyodide.py | 17 +++++++++++++++++ 4 files changed, 30 insertions(+) rename test/{ => packages}/test_numpy.py (100%) rename test/{ => packages}/test_pandas.py (100%) create mode 100644 test/src/test_pyodide.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 8d89c5dcc..ba5a45797 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,17 @@ jobs: command: | pytest test -v -k chrome + test-python: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: . + - run: + name: test + command: | + pytest test -v -k 'not (chrome or firefox)' + benchmark: <<: *defaults steps: @@ -106,6 +117,7 @@ workflows: - test-firefox: requires: - build + - test-python - benchmark: requires: - build @@ -113,6 +125,7 @@ workflows: requires: - test-chrome - test-firefox + - test-python filters: branches: only: master diff --git a/test/test_numpy.py b/test/packages/test_numpy.py similarity index 100% rename from test/test_numpy.py rename to test/packages/test_numpy.py diff --git a/test/test_pandas.py b/test/packages/test_pandas.py similarity index 100% rename from test/test_pandas.py rename to test/packages/test_pandas.py diff --git a/test/src/test_pyodide.py b/test/src/test_pyodide.py new file mode 100644 index 000000000..fdd1a999c --- /dev/null +++ b/test/src/test_pyodide.py @@ -0,0 +1,17 @@ +import sys +from pathlib import Path +from textwrap import dedent + +sys.path.append(str(Path(__file__).parents[2] / 'src')) + +from pyodide import find_imports # noqa: E402 + + +def test_find_imports(): + + res = find_imports(dedent(""" + import six + import numpy as np + from scipy import sparse + """)) + assert set(res) == {'numpy', 'scipy', 'six'} From 53de9fa548bbb992e622ed33abe748dedef6a6dd Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Mon, 15 Oct 2018 20:56:14 +0200 Subject: [PATCH 2/3] Attaching the workspace before build is not necessary --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ba5a45797..8fd265b5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,8 +73,6 @@ jobs: <<: *defaults steps: - checkout - - attach_workspace: - at: . - run: name: test command: | From 436192569e2d58312eb7f42a9f0f695afed71da7 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Mon, 15 Oct 2018 21:08:43 +0200 Subject: [PATCH 3/3] Check find_imports('import matplotlib.pyplot as plt') --- test/src/test_pyodide.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/src/test_pyodide.py b/test/src/test_pyodide.py index fdd1a999c..368f41714 100644 --- a/test/src/test_pyodide.py +++ b/test/src/test_pyodide.py @@ -13,5 +13,6 @@ def test_find_imports(): import six import numpy as np from scipy import sparse + import matplotlib.pyplot as plt """)) - assert set(res) == {'numpy', 'scipy', 'six'} + assert set(res) == {'numpy', 'scipy', 'six', 'matplotlib'}