Skip to content

Editor's -runpythontest and -pythontestcase flags requires that files do not end in a newline #13174

Open
@burelc-amzn

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:

  1. Build the Editor
  2. 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
  3. Make a file in the build directory called pythontestcase.txt with the contents AutomatedTesting/Gem/PythonTests/Prefab/TestSuite_Main.py::TestAutomationNoAutoTestMode::test_ReparentPrefab_UnderPrefabAndEntityHierarchies\n
  4. 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

Metadata

Assignees

No one assigned

    Labels

    feature/python-bindingsThis item is related to the python bindings.kind/bugCategorizes issue or PR as related to a bug.priority/majorMajor priority. Work that should be handled after all blocking and critical work is done.sig/contentCategorizes an issue or PR as relevant to SIG Content.sig/testingCategorizes an issue or PR as relevant to SIG Testing.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions