mirror of https://github.com/pyodide/pyodide.git
Better tests when loading multiple packages
This commit is contained in:
parent
82cd3e4576
commit
82a625641b
|
@ -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) => {
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue