Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
b8b95195
Commit
b8b95195
authored
Jun 15, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work trying to get linting working again
parent
af3a0a13
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
18 deletions
+27
-18
.circleci/config.yml
.circleci/config.yml
+1
-1
.editorconfig
.editorconfig
+4
-1
Makefile
Makefile
+2
-1
src/pyodide.js
src/pyodide.js
+2
-2
src/pyproxy.c
src/pyproxy.c
+3
-3
test/conftest.py
test/conftest.py
+4
-2
test/make_test_list.py
test/make_test_list.py
+2
-1
test/test_python.py
test/test_python.py
+9
-7
No files found.
.circleci/config.yml
View file @
b8b95195
...
...
@@ -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
...
...
.editorconfig
View file @
b8b95195
...
...
@@ -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
Makefile
View file @
b8b95195
...
...
@@ -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
...
...
src/pyodide.js
View file @
b8b95195
...
...
@@ -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
)
=>
{
...
...
src/pyproxy.c
View file @
b8b95195
...
...
@@ -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
});
test/conftest.py
View file @
b8b95195
...
...
@@ -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
())
...
...
test/make_test_list.py
View file @
b8b95195
...
...
@@ -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
=
''
...
...
test/test_python.py
View file @
b8b95195
...
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment