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

[Hello World] Added Hello World to ImportError Message Extraction #111

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

BethanyG
Copy link
Member

@BethanyG BethanyG commented Feb 25, 2023

Decided that we should do for Hello World what we did for Lasagna (see #110 for some details).

Added hello_world to the function starting on line 140:

    def pytest_exception_interact(self, node, call, report):
        """
        Catch the last exception handled in case the test run itself errors.
        """
        if report.outcome == "failed":
            excinfo = call.excinfo
            err = excinfo.getrepr(style="no", abspath=False)

            # trim off full traceback for first two exercises to be friendlier and clearer
            if ('lasagna' in node.name or 'hello_world' in node.name) and 'ImportError' in str(err.chain[0]):
                trace = err.chain[-2][0]
            else:
                trace = err.chain[-1][0]

            crash = err.chain[0][1]
            self.last_err = self._make_message(trace, crash)

Now they will see the following in the UI (once the test file changes in the content repo are merged):

ImportError: 
   
MISSING FUNCTION --> In your 'hello_world.py' file, we can not find or import the function named hello().
The tests for this first exercise expect a function that returns the string "Hello, World!"
 
Did you use print("Hello, World!") instead?

Also added a test for this exercise/scenario.

@BethanyG
Copy link
Member Author

BethanyG commented Mar 3, 2023

Many thanks!

@BethanyG BethanyG merged commit c7677cd into exercism:main Mar 3, 2023
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.

2 participants