beeware / batavia

A JavaScript implementation of the Python virtual machine.
http://pybee.org/batavia
Other
1.39k stars 425 forks source link

Unittests fail to run at all #797

Closed alexjdw closed 5 years ago

alexjdw commented 5 years ago

Expected Behavior

Unittest runs tests.

Current Behavior

$ python -m unittest tests/datatypes/test_int.py building 'batavia.js' for development

The program hangs here permanently. Pressing Ctrl+C reveals that it's trying to acquire a lock of some kind. Here's the trimmed-down traceback.

File "C:\Users\Alex.pyenv\pyenv-win\versions\3.5.1\Lib\subprocess.py", line 1068, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "C:\Users\Alex.pyenv\pyenv-win\versions\3.5.1\Lib\subprocess.py", line 1308, in _communicate self.stdout_thread.join(self._remaining_time(endtime)) File "C:\Users\Alex.pyenv\pyenv-win\versions\3.5.1\Lib\threading.py", line 1054, in join self._wait_for_tstate_lock() File "C:\Users\Alex.pyenv\pyenv-win\versions\3.5.1\Lib\threading.py", line 1070, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt

Steps to reproduce

  1. git clone batavia and follow the setup steps here: https://github.com/beeware/batavia

  2. python -m unittest tests/datatypes/test_int.py

I also tested the Django test server. That runs just fine, although a bit crashy when trying to actually run Python.

Tried deleting and redoing the steps.

Environment

Windows 10 / Visual Studio Code / Git Bash (also happens in cmd.exe.) Python: 3.5.1 from pyenv-win NPM 6.9.0

Possibly an issue with my Python installation since traceback is from my PyEnv folder? I haven't used 3.5.1 before.

martica commented 5 years ago

Can you give it a try with PRECOMPILE set to false? If you've run the server, you should have batavia.js built in your dist folder.

From bash you should be able to run: PRECOMPILE=false python -u unittest tests/datatypes/test_int.py

martica commented 5 years ago

The suggested test command is slightly different, using setup.py.

alexjdw commented 5 years ago

Thanks for the quick reply and sorry for the delay. First of all it should be -m instead of -u, correct? -u gives me a straight error.

The tests are now all failing immediately with a file not found error:

Error: Cannot find module 'C:UsersAlexDocumentatavia-deataviadisatavia.js' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at evalmachine.:1:77 at process.send._capture_stdout (C:\Users\Alex\Documents\batavia-dev\batavia\tests\test_worker.js:11:50) at _capture_stdout (C:\Users\Alex\Documents\batavia-dev\batavia\tests\test_worker.js:30:5) at process. (C:\Users\Alex\Documents\batavia-dev\batavia\tests\test_worker.js:9:18) at emitTwo (events.js:126:13) at process.emit (events.js:214:7)

That filename looks badly mangled.

$ cd batavia $ ls batavia.js builtins builtins.js core core.js modules modules.js operators.js stdlib stdlib.js types types.js VirtualMachine.js

Seems like all the gang is in the folder. Maybe it's getting confused on a os.path.join somewhere?

martica commented 5 years ago

That path does not sound right. :)

Are you able to join us on Gitter? Chat might be easier to try to diagnose things.

alexjdw commented 5 years ago

Sure thing, what channel do I need to join?

martica commented 5 years ago

https://gitter.im/beeware/general