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
227f7487
Commit
227f7487
authored
Sep 20, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test loading from URLs using both the main and secondary web servers
parent
6de43c9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
src/pyodide.js
src/pyodide.js
+0
-2
test/test_package_loading.py
test/test_package_loading.py
+21
-12
No files found.
src/pyodide.js
View file @
227f7487
...
@@ -80,8 +80,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
...
@@ -80,8 +80,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
}
}
}
}
console
.
log
(
`Trying to load
${
Object
.
keys
(
toLoad
)}
`
);
window
.
pyodide
.
_module
.
locateFile
=
(
path
)
=>
{
window
.
pyodide
.
_module
.
locateFile
=
(
path
)
=>
{
// handle packages loaded from custom URLs
// handle packages loaded from custom URLs
let
package
=
path
.
replace
(
/
\.
data$/
,
""
);
let
package
=
path
.
replace
(
/
\.
data$/
,
""
);
...
...
test/test_package_loading.py
View file @
227f7487
import
pytest
import
pytest
def
test_load_from_url
(
selenium_standalone
,
web_server_secondary
):
@
pytest
.
mark
.
parametrize
(
'active_server'
,
[
'main'
,
'secondary'
])
def
test_load_from_url
(
selenium_standalone
,
web_server_secondary
,
url
,
port
,
log_secondary
=
web_server_secondary
active_server
):
log_main
=
selenium_standalone
.
server_log
if
active_server
==
'secondary'
:
url
,
port
,
log_main
=
web_server_secondary
with
log_secondary
.
open
(
'r'
)
as
fh_secondary
,
\
log_backup
=
selenium_standalone
.
server_log
elif
active_server
==
'main'
:
_
,
_
,
log_backup
=
web_server_secondary
log_main
=
selenium_standalone
.
server_log
url
=
selenium_standalone
.
server_hostname
port
=
selenium_standalone
.
server_port
else
:
raise
AssertionError
()
with
log_backup
.
open
(
'r'
)
as
fh_backup
,
\
log_main
.
open
(
'r'
)
as
fh_main
:
log_main
.
open
(
'r'
)
as
fh_main
:
# skip existing log lines
# skip existing log lines
fh_main
.
seek
(
0
,
2
)
fh_main
.
seek
(
0
,
2
)
fh_
secondary
.
seek
(
0
,
2
)
fh_
backup
.
seek
(
0
,
2
)
selenium_standalone
.
load_package
(
f"http://
{
url
}
:
{
port
}
/pyparsing.js"
)
selenium_standalone
.
load_package
(
f"http://
{
url
}
:
{
port
}
/pyparsing.js"
)
assert
"Invalid package name or URI"
not
in
selenium_standalone
.
logs
assert
"Invalid package name or URI"
not
in
selenium_standalone
.
logs
# check that all ressources were loaded from the
secondary
server
# check that all ressources were loaded from the
active
server
txt
=
fh_
secondary
.
read
()
txt
=
fh_
main
.
read
()
assert
'"GET /pyparsing.js HTTP/1.1" 200'
in
txt
assert
'"GET /pyparsing.js HTTP/1.1" 200'
in
txt
assert
'"GET /pyparsing.data HTTP/1.1" 200'
in
txt
assert
'"GET /pyparsing.data HTTP/1.1" 200'
in
txt
# no additional ressources were loaded from the
main
server
# no additional ressources were loaded from the
other
server
assert
len
(
fh_
main
.
read
())
==
0
assert
len
(
fh_
backup
.
read
())
==
0
selenium_standalone
.
run
(
"from pyparsing import Word, alphas"
)
selenium_standalone
.
run
(
"from pyparsing import Word, alphas"
)
selenium_standalone
.
run
(
"Word(alphas).parseString('hello')"
)
selenium_standalone
.
run
(
"Word(alphas).parseString('hello')"
)
...
...
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