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
ed3e0c54
Commit
ed3e0c54
authored
Sep 04, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TST Load multiple dependent and independent packages
Also remove the (failing) tests with simultaneous package loading
parent
82a62564
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
25 deletions
+12
-25
test/test_package_loading.py
test/test_package_loading.py
+12
-25
No files found.
test/test_package_loading.py
View file @
ed3e0c54
import
pytest
from
selenium.common.exceptions
import
WebDriverException
from
.conftest
import
PackageLoaded
def
test_load_from_url
(
selenium_standalone
,
web_server
):
...
...
@@ -37,28 +36,16 @@ def test_invalid_package_name(selenium):
selenium
.
load_package
(
'tcp://some_url'
)
def
test_load_packages_multiple
(
selenium_standalone
):
@
pytest
.
mark
.
parametrize
(
'packages'
,
[[
'pyparsing'
,
'pytz'
],
[
'pyparsing'
,
'matplotlib'
]],
ids
=
'-'
.
join
)
def
test_load_packages_multiple
(
selenium_standalone
,
packages
):
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'
)
def
test_load_packages_simultaneous
(
selenium_standalone
):
selenium
=
selenium_standalone
from
selenium.common.exceptions
import
TimeoutException
selenium
.
run_js
(
'window.done = false
\
n
'
'pyodide.loadPackage("numpy")
\
n
'
'pyodide.loadPackage("matplotlib")'
'.then(function() { window.done = true; })'
)
try
:
selenium
.
wait
.
until
(
PackageLoaded
())
except
TimeoutException
as
exc
:
print
(
selenium
.
logs
)
raise
TimeoutException
()
assert
selenium
.
logs
.
count
(
'Loading numpy'
)
==
1
selenium
.
load_package
(
packages
)
selenium
.
run
(
f'import
{
packages
[
0
]
}
'
)
selenium
.
run
(
f'import
{
packages
[
1
]
}
'
)
# The long must show that each package is loaded exactly once,
# including when one package is a dependency of the other
# ('pyparsing' and 'matplotlib')
assert
selenium
.
logs
.
count
(
f'Loading
{
packages
[
0
]
}
'
)
==
1
assert
selenium
.
logs
.
count
(
f'Loading
{
packages
[
1
]
}
'
)
==
1
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