Import PyScript Version into Python Runtime (#958)

* Import current version as PyScript.__version__ and PyScript.version_info

* Add integration, python unit tests
 
* Mock pyscript.py with __mocks__/pyscript.js to make jest tests happy
This commit is contained in:
Jeff Glass
2022-11-18 11:49:45 -06:00
committed by GitHub
parent 0e1c396d7c
commit 687b93d148
9 changed files with 118 additions and 7 deletions

View File

@@ -0,0 +1,14 @@
/**
* this file mocks the `src/python/pyscript.py` file
* since importing of `.py` files isn't usually supported
* inside JS/TS files.
*
* It sets the value of whatever is imported from
* `src/python/pyscript.py` the contents of that file
*
* This is needed since the imported object is further
* passed to a function which only accepts a string.
*/
const fs = require('fs');
module.exports = fs.readFileSync('./src/python/pyscript.py', 'utf8');