Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test_user_script_crash test (#709) #777

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

nurbal
Copy link
Contributor

@nurbal nurbal commented Feb 2, 2022

Description

Detects if a by-design crashing black-box script Traceback is visible in the stderr output of orion.

The test succeeds, which indicates that the stacktrace is indeed visible by the user on his terminal output.

Is meant to implement issue #709

Changes

Just a test, since the behaviour is already good.
Added a "black box" utility script that can return a code passed by argument, and/or crash if -c argument is specified.

Checklist

Tests

  • I added corresponding tests for bug fixes and new features. If possible, the tests fail without the changes
  • All new and existing tests are passing ($ tox -e py38; replace 38 by your Python version if necessary)

Documentation

  • I have updated the relevant documentation related to my changes

Quality

  • I have read the CONTRIBUTING doc
  • My commits messages follow this format
  • My code follows the style guidelines ($ tox -e lint)

Further comments

n/a

Detects if a by-design crashing black-box script Traceback is visible in the stderr output of orion.
def test_user_script_crash(capfd):
"""Checks that the Traceback of a crashing user script is output to stderr"""

orion.core.cli.main(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test if failing because the script is not found. Pytest is executed from the root so it cannot find this file at the root. You can use monkeypatch to change the working dir temporarily: https://github.com/Epistimio/orion/blob/develop/tests/functional/commands/conftest.py#L61

Note, the first test of this module is not crashing because it has the fixture one_experiment which does this change of working directory.

"-c",
"-x~uniform(-5,5)",
]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could test the exit-code at the same time. The main should return it.

Co-authored-by: Xavier Bouthillier <xavier.bouthillier@gmail.com>
@bouthilx bouthilx added this to the v0.2.3 milestone Feb 13, 2022
@bouthilx bouthilx modified the milestones: v0.2.3, v0.2.5 Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants