mirror of https://github.com/pyodide/pyodide.git
Fix tests
This commit is contained in:
parent
9836791bed
commit
7f3027b6f4
|
@ -45,24 +45,27 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
|||
const package = _uri_to_package_name(package_uri);
|
||||
|
||||
if (package == null) {
|
||||
throw new Error(`Invalid package name or URI '${package_uri}'`);
|
||||
console.error(`Invalid package name or URI '${package_uri}'`);
|
||||
return;
|
||||
} else if (package == package_uri) {
|
||||
package_uri = 'default channel';
|
||||
}
|
||||
|
||||
if (package in loadedPackages) {
|
||||
if (package_uri != loadedPackages[package]) {
|
||||
throw new Error(
|
||||
console.error(
|
||||
`URI mismatch, attempting to load package ` +
|
||||
`${package} from ${package_uri} while it is already ` +
|
||||
`loaded from ${loadedPackages[package]}!`);
|
||||
return;
|
||||
}
|
||||
} else if (package in toLoad) {
|
||||
if (package_uri != toLoad[package]) {
|
||||
throw new Error(
|
||||
console.error(
|
||||
`URI mismatch, attempting to load package ` +
|
||||
`${package} from ${package_uri} while it is already ` +
|
||||
`being loaded from ${toLoad[package]}!`);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.log(`Loading ${package} from ${package_uri}`);
|
||||
|
@ -125,8 +128,7 @@ var languagePluginLoader = new Promise((resolve, reject) => {
|
|||
let loadPackage = (names) => {
|
||||
/* We want to make sure that only one loadPackage invocation runs at any
|
||||
* given time, so this creates a "chain" of promises. */
|
||||
loadPackagePromise = loadPackagePromise.then(() => _loadPackage(names))
|
||||
.catch((e) => console.log(e.to_string()));
|
||||
loadPackagePromise = loadPackagePromise.then(() => _loadPackage(names));
|
||||
return loadPackagePromise;
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
console.info = function(message) {
|
||||
window.logs.push(message);
|
||||
}
|
||||
console.error = function(message) {
|
||||
window.logs.push(message);
|
||||
}
|
||||
</script>
|
||||
<script src="pyodide_dev.js"></script>
|
||||
</head>
|
||||
|
|
|
@ -25,14 +25,12 @@ def test_uri_mismatch(selenium_standalone):
|
|||
|
||||
|
||||
def test_invalid_package_name(selenium):
|
||||
with pytest.raises(WebDriverException,
|
||||
match="Invalid package name or URI"):
|
||||
selenium.load_package('wrong name+$')
|
||||
selenium.load_package('wrong name+$')
|
||||
assert "Invalid package name or URI" in selenium.logs
|
||||
selenium.clean_logs()
|
||||
|
||||
with pytest.raises(WebDriverException,
|
||||
match="Invalid package name or URI"):
|
||||
selenium.load_package('tcp://some_url')
|
||||
selenium.load_package('tcp://some_url')
|
||||
assert "Invalid package name or URI" in selenium.logs
|
||||
|
||||
|
||||
@pytest.mark.parametrize('packages', [['pyparsing', 'pytz'],
|
||||
|
|
Loading…
Reference in New Issue