Commit b8b95195 authored by Michael Droettboom's avatar Michael Droettboom

More work trying to get linting working again

parent af3a0a13
......@@ -12,12 +12,12 @@ jobs:
- run:
name: dependencies
command: |
sudo apt-get install node-less cmake build-essential clang-format flake8
# We need at least g++-8, but stretch comes with g++-6
# Set up the Debian testing repo, and then install g++ from there...
sudo bash -c "echo \"deb http://ftp.us.debian.org/debian testing main contrib non-free\" >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get install node-less cmake build-essential clang-format-6.0 flake8
sudo apt-get install -t testing g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8
......
......@@ -7,5 +7,8 @@ charset = utf-8
indent_size = 2
indent_style = space
[*.py]
indent_size = 4
[Makefile]
indent_style = tab
\ No newline at end of file
indent_style = tab
......@@ -137,7 +137,8 @@ test: all build/test.html
lint:
flake8 src
flake8 test
clang-format -output-replacements-xml src/*.c src/*.h src/*.js | (! grep '<replacement ')
benchmark: all build/test.html
python benchmark/benchmark.py $(HOSTPYTHON) build/benchmarks.json
......
......@@ -12,12 +12,12 @@ var languagePluginLoader = new Promise((resolve, reject) => {
// Package loading
const packages = {
'dateutil' : [],
'kiwisolver': [],
'kiwisolver' : [],
'matplotlib' : [ 'numpy', 'dateutil', 'pytz', 'kiwisolver' ],
'numpy' : [],
'pandas' : [ 'numpy', 'dateutil', 'pytz' ],
'pytz' : [],
'test': []
'test' : []
};
let loadedPackages = new Set();
let loadPackage = (names) => {
......
......@@ -117,8 +117,8 @@ _pyproxy_apply(int ptrobj, int idargs)
}
EM_JS(int, pyproxy_new, (int ptrobj), {
var target = function() {};
target['$$'] = { ptr: ptrobj, type: 'PyProxy' };
var target = function(){};
target['$$'] = { ptr : ptrobj, type : 'PyProxy' };
return Module.hiwire_new_value(new Proxy(target, Module.PyProxy));
});
......@@ -208,5 +208,5 @@ EM_JS(int, pyproxy_init, (), {
};
return 0;
// clang-format on
// clang-format on
});
......@@ -37,7 +37,8 @@ class SeleniumWrapper:
options = Options()
options.add_argument('-headless')
driver = Firefox(executable_path='geckodriver', firefox_options=options)
driver = Firefox(
executable_path='geckodriver', firefox_options=options)
wait = WebDriverWait(driver, timeout=20)
driver.get((BUILD_PATH / "test.html").as_uri())
wait.until(PyodideInited())
......@@ -58,7 +59,8 @@ class SeleniumWrapper:
def load_package(self, packages):
self.run_js(
'window.done = false\n'
'pyodide.loadPackage({!r}).then(window.done = true)'.format(packages))
'pyodide.loadPackage({!r}).then(window.done = true)'.format(
packages))
time.sleep(2)
self.wait.until(PackageLoaded())
......
......@@ -7,7 +7,8 @@ import os
tests = []
TEST_DIR = "../cpython/build/3.6.4/host/lib/python3.6/test"
for root, dirs, files in os.walk("../cpython/build/3.6.4/host/lib/python3.6/test"):
for root, dirs, files in os.walk(
"../cpython/build/3.6.4/host/lib/python3.6/test"):
root = os.path.relpath(root, TEST_DIR)
if root == '.':
root = ''
......
......@@ -112,7 +112,7 @@ def test_pyproxy(selenium):
)
assert selenium.run_js("return pyodide.pyimport('f').get_value(2)") == 128
assert selenium.run_js("return pyodide.pyimport('f').bar") == 42
assert selenium.run_js("return ('bar' in pyodide.pyimport('f'))") == True
assert selenium.run_js("return ('bar' in pyodide.pyimport('f'))")
selenium.run_js("f = pyodide.pyimport('f'); f.baz = 32")
assert selenium.run("f.baz") == 32
assert set(selenium.run_js(
......@@ -124,10 +124,11 @@ def test_pyproxy(selenium):
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__', '__subclasshook__', '__weakref__', 'bar', 'baz',
'get_value', 'toString', 'prototype'])
assert selenium.run("hasattr(f, 'baz')") == True
assert selenium.run("hasattr(f, 'baz')")
selenium.run_js("delete pyodide.pyimport('f').baz")
assert selenium.run("hasattr(f, 'baz')") == False
assert selenium.run_js("return pyodide.pyimport('f').toString()").startswith('<Foo')
assert not selenium.run("hasattr(f, 'baz')")
assert selenium.run_js(
"return pyodide.pyimport('f').toString()").startswith('<Foo')
def test_jsproxy(selenium):
......@@ -171,7 +172,8 @@ def pytest_generate_tests(metafunc):
if 'python_test' in metafunc.fixturenames:
test_modules = []
with open(
str(pathlib.Path(__file__).parents[0] / "python_tests.txt")) as fp:
str(pathlib.Path(__file__).parents[0] /
"python_tests.txt")) as fp:
for line in fp:
line = line.strip()
if line.startswith('#'):
......@@ -179,8 +181,8 @@ def pytest_generate_tests(metafunc):
parts = line.split()
if len(parts) == 1:
test_modules.append(parts[0])
# XXX: The tests take too long to run, so we're just doing a
# sanity check on the first 25
# XXX: The tests take too long to run, so we're just doing
# a sanity check on the first 25
if 'TRAVIS' in os.environ and len(test_modules) > 25:
break
metafunc.parametrize("python_test", test_modules)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment