Editor's -runpythontest
and -pythontestcase
flags requires that files do not end in a newline #13174
Description
The Editor runs python tests by using the flags -runpythontest
and -pythontestcase
. These flags are designed to refer to files on disk that instruct the running Editor instance which python tests to run. However, if these files end with a newline, the Editor application will exit with status 15 instead of running the test. This makes it difficult to debug failing tests, as it is difficult to make these files by hand (most text editors will create files that end in a newline, as that's how the POSIX standard defines lines within files).
Steps to reproduce
Steps to reproduce the behavior:
- Build the Editor
- Make a file in the build directory called
runpythontest.txt
with the contents/absolute/path/to/o3de/worktree/AutomatedTesting/Gem/PythonTests/Prefab/tests/reparent_prefab/ReparentPrefab_UnderPrefabAndEntityHierarchies.py\n
- Make a file in the build directory called
pythontestcase.txt
with the contentsAutomatedTesting/Gem/PythonTests/Prefab/TestSuite_Main.py::TestAutomationNoAutoTestMode::test_ReparentPrefab_UnderPrefabAndEntityHierarchies\n
- Launch the Editor to run the test:
bin/profile/Editor --project-path=../AutomatedTesting -runpythontest $PWD/runpythontest.txt -pythontestcase $PWD/pythontestcase.txt -BatchMode -rhi=null --regset=/Amazon/Preferences/EnablePrefabSystem=true
Expected behavior
The Editor runs the test and reports a pass/fail status
Actual behavior
The Editor exits with status 15.
Found in Branch
development
as of 3a7b8b2
Desktop/Device (please complete the following information):
- Device: PC
- OS: Linux
- Version Ubuntu 20.04
Additional context
With vim
, you can suppress the \n
by running set binary | set noeol
before writing the file. So you can take the files made in step 2 and 3, remove the trailing newline, then rerun the Editor to see that the tests now execute