package: switch to @pybricks/python-program-analysis

The package we were using was only for Python 3.4 and didn't include
async/await which broke imports in any script that used async/await.

Fixes: https://github.com/pybricks/support/issues/873
This commit is contained in:
David Lechner
2022-12-22 13:21:02 -06:00
committed by David Lechner
parent a77acc1001
commit bb2fa3ae1d
5 changed files with 27 additions and 8 deletions
+15
View File
@@ -131,3 +131,18 @@ from q import q
]),
);
});
test('https://github.com/pybricks/support/issues/873 regression', () => {
const script = `
from my_module import data
async def hello():
print("hello")
print(data)
`;
const modules = findImportedModules(script);
expect(modules).toEqual(new Set(['my_module']));
});
+2 -2
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import { parse, walk } from '@qoretechnologies/python-parser';
import { parse, walk } from '@pybricks/python-program-analysis';
import type { FileContents, FileStorageDb } from '../fileStorage';
/** The Python file extension ('.py') */
@@ -99,7 +99,7 @@ export function findImportedModules(py: string): ReadonlySet<string> {
});
} catch (err) {
// istanbul ignore if
if (process.env.NODE_ENV !== 'test') {
if (process.env.NODE_ENV === 'test') {
console.error(err);
}