mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
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:
committed by
David Lechner
parent
a77acc1001
commit
bb2fa3ae1d
@@ -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']));
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user