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
82a62564
Commit
82a62564
authored
Sep 03, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better tests when loading multiple packages
parent
82cd3e45
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
src/pyodide.js
src/pyodide.js
+9
-2
test/test_package_loading.py
test/test_package_loading.py
+6
-2
No files found.
src/pyodide.js
View file @
82a62564
...
...
@@ -49,8 +49,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
package_uri
=
'
default channel
'
;
}
console
.
log
(
`Loading
${
package
}
from
${
package_uri
}
`
);
if
(
package
in
loadedPackages
)
{
if
(
package_uri
!=
loadedPackages
[
package
])
{
throw
new
Error
(
...
...
@@ -58,7 +56,16 @@ var languagePluginLoader = new Promise((resolve, reject) => {
`
${
package
}
from
${
package_uri
}
while it is already `
+
`loaded from
${
loadedPackages
[
package
]}
!`
);
}
}
else
if
(
package
in
toLoad
)
{
if
(
package_uri
!=
toLoad
[
package
])
{
throw
new
Error
(
`URI mismatch, attempting to load package `
+
`
${
package
}
from
${
package_uri
}
while it is already `
+
`being loaded from
${
toLoad
[
package
]}
!`
);
}
}
else
{
console
.
log
(
`Loading
${
package
}
from
${
package_uri
}
`
);
toLoad
[
package
]
=
package_uri
;
if
(
packages
.
hasOwnProperty
(
package
))
{
packages
[
package
].
forEach
((
subpackage
)
=>
{
...
...
test/test_package_loading.py
View file @
82a62564
...
...
@@ -37,8 +37,12 @@ def test_invalid_package_name(selenium):
selenium
.
load_package
(
'tcp://some_url'
)
def
test_load_packages_multiple
(
selenium
):
selenium
.
load_package
([
'pyparsing'
,
'pytz'
])
def
test_load_packages_multiple
(
selenium_standalone
):
selenium
=
selenium_standalone
selenium
.
load_package
([
'pyparsing'
,
'matplotlib'
])
selenium
.
run
(
'import pyparsing'
)
selenium
.
run
(
'import matplotlib'
)
assert
selenium
.
logs
.
count
(
'Loading pyparsing'
)
==
1
@
pytest
.
mark
.
xfail
(
reason
=
'Not implemented'
)
...
...
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