Obviously, os.path.dirname returns an empty string here. As much as the user can overwrite the cmd_entrypoint value to include an absolute or relative path, the default value should work under the right circumstances. The fix is very simple, wrap the cls.cmd_entrypoint[0] argument with a os.path.abspath call — which is a pretty common practice actually. This will convert any valid path provided (including no path information at all if the file is in the cwd) into the full absolute path to the existing file.
PR on the way soon.
Various logs and file contents
main.py
import platform
import kivy
from kivy.app import App
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
class FretboardDojo(App):
def build(self):
root_layout = AnchorLayout(anchor_x="center", anchor_y="center")
widget_layout = BoxLayout(orientation="vertical", size_hint=(None, None))
widget_layout.add_widget(Label(text='Test App'))
widget_layout.add_widget(Label(text=f'Python {platform.python_version()}'))
widget_layout.add_widget(Label(text=f'Kivy {kivy.__version__}'))
root_layout.add_widget(widget_layout)
return root_layout
if __name__ == "__main__":
FretboardDojo().run()
from telenium.tests import TeleniumTestCase
class TestFretboardDojo(TeleniumTestCase):
def test_startup_screen(self):
self.assertExists("//Label[@text~=\"Test App\"]", timeout=2)
PyCharm Console Output
/home/pdallair/anaconda3/envs/telenium/bin/python /snap/pycharm-community/261/plugins/python-ce/helpers/pycharm/_jb_unittest_runner.py --path /home/pdallair/dev/PycharmProjects/Telenium/TestApp/test.py
Testing started at 8:34 p.m. ...
Launching unittests with arguments python -m unittest /home/pdallair/dev/PycharmProjects/Telenium/TestApp/test.py in /home/pdallair/dev/PycharmProjects/Telenium/TestApp
> app_quit: ()
Failure
Traceback (most recent call last):
File "/home/pdallair/anaconda3/envs/telenium/lib/python3.9/unittest/suite.py", line 166, in _handleClassSetUp
setUpClass()
File "/home/pdallair/dev/PycharmProjects/Telenium/telenium/tests.py", line 121, in setUpClass
cls.start_process()
File "/home/pdallair/dev/PycharmProjects/Telenium/telenium/tests.py", line 66, in start_process
cls.start_desktop_process(cmd=cmd, env=env)
File "/home/pdallair/dev/PycharmProjects/Telenium/telenium/tests.py", line 87, in start_desktop_process
cls.process = subprocess.Popen(cmd, env=env, cwd=cwd)
File "/home/pdallair/anaconda3/envs/telenium/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/pdallair/anaconda3/envs/telenium/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ''
Description
When using
TeleniumTestCase
's defaultcmd_entrypoint
value ([main.py]
) we run into a problem at the following method call.Obviously,
os.path.dirname
returns an empty string here. As much as the user can overwrite thecmd_entrypoint
value to include an absolute or relative path, the default value should work under the right circumstances. The fix is very simple, wrap thecls.cmd_entrypoint[0]
argument with aos.path.abspath
call — which is a pretty common practice actually. This will convert any valid path provided (including no path information at all if the file is in the cwd) into the full absolute path to the existing file.PR on the way soon.
Various logs and file contents
main.py
buildozer.spec
test.py
PyCharm Console Output