question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hello-world: code fails the test locally but passes the uploader

See original GitHub issue

I assume that Exercism should reject uploaded code if that code would fail the local test. But this hello-world.py code passes if uploaded but fails the local test:

def hello():
    print("Hello, World!")

hello()

As a newbie, it took me quite a while to figure out why it was failing the test locally—it fails because this function doesn’t actually “return a value” when run, it just prints a string and returns None. So to pass the test locally, I had to write:

def hello():
    return("Hello, World!")

print(hello())

I have two suggestions: (1) ensure that the uploader and the local test file are doing the same test so that a user either passes both or fails both; and (2) consider, in the instructions, making it clearer that the exercise’s goal (have the program return a value of “Hello, World!”) is not the same thing as having the program simply print or display the string “Hello, World!”.

I have not submitted this as a pull request because I don’t know how to get at the tests in the uploader and because changing the instructions for “Hello, World!” might have to be done across exercises (if you agree with me).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bhagertycommented, Nov 12, 2019

Thanks @yawpitch . The explanation as to how different languages handle a similar situation is very helpful, as is the idea that creating some kind of a hurdle here is a feature, not a bug. Thanks for the explanation. It makes sense.

0reactions
yawpitchcommented, Nov 12, 2019

I’m afraid I’m not persuaded – and am not likely to be – but allow me to make unambiguous why.

Regarding this return line in particular there really is no contradiction in our rationales; the existing statement is used across all the tracks on exercism and is “perfectly clear” – meaning not “absolutely and rigorously unambiguous” but “immediately and readily cognizable” – to the site’s targeted audience; the learning challenges presented to that audience as they start to pick up a new (and, usually, second or third) language are:

  1. How do I create a string in this language?
  2. How do I return a value in this language for test validation?

Because that audience, whom we expect to have at least some programming experience, already knows that programming languages must have an in-built capacity for working with textual data and some means of giving a meaningful result back to the caller for further processing. The specific answer to those challenges is very different from language to language:

  1. Python has two different “string” types and a return keyword.
  2. Haskell has (at last glance) 5 different commonly-used types for handling textual data and uses implicit returns (their return function is for something quite different).
  3. In Bash you actually do “return” a string by writing it to stdout, because the only “return value” that Bash knows is the process exit code.

In yet other languages you’ll “return” by writing to a specific CPU register or handing back a pointer to a memory address. In some very new orchestration languages you’d make a PUT call to a RPC / HTTP endpoint … given all of that the notion of “set a return value that is a string” isn’t necessarily sensible to all of those – or to people coming to Python from them – while the notion of a returning / giving back a specific string / piece of text, broadly, is.

So the intentional ambiguity, on our part, is indeed in prodding the user to recognize those challenges and to begin thinking about how to address them. That provocation is both warranted and clear, and no we don’t want to “give away the ghost” by providing an overly explicit, especially language-specific, answer. For our primary audience there’s no need for this particular phrase to be any more explicit than it already is.

Further, when it comes to those at the fringes or outside of that audience, we’ve got a bit of a filtering problem … the simple truth is that anyone who cannot make it past hello-world without us resolving the ambiguity in this phrase more clearly is, to be perfectly frank, not sufficiently prepared for the exercises that will follow, and will overwhelm us if we lower the bar much further. We’re very much not trying to teach Python to the completely new, utterly first-time programmer, so we require anyone who is coming at it from that fresh a perspective to demonstrate sufficient initiative that they can download the files, run the tests locally at the command line, update the file(s) as required until they can get the tests to pass, and then upload their solution without handholding … that’s the minimum effort and skillset threshold we need met before our mentors begin to spend their – entirely volunteered – time trying to help the prospective student.

You’ve responded to our provocation and demonstrated that initiative by getting this far … that’s wonderful, because it means the site is working for you, even if it’s been frustrating. I very much appreciate the effort you’re attempting to put into helping the community, we need that sort of help. However I’m also aware of what’s going on “behind the scenes” as we move towards rolling out more changes that are meant to address the issues of complete newbies while also keeping maintainer / mentor workloads sustainable, and I hope that you can appreciate that @cmccandless and I know where the energy and time of maintainers needs to be focussed … which is, gently but firmly, NOT on working to make hello-world any more accessible than it already is.

All that said please do ping this thread when you submit a PR on the “check” copy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests pass locally but "fail" on CI (i.e. test suites fail ... - GitHub
It probably means your require strings don't match the file names. Is the file called helpers.test.js or Helpers.test.js . Please note this ...
Read more >
Why tests pass locally but fail in Jenkins | Object Partners
Symptom: Tests pass locally when run in a certain order, but fail in Jenkins when run in a different order (or tests pass/fail...
Read more >
Build local unit tests - Android Developers
A unit test verifies the behavior of a small section of code, the unit under test. It does so by executing that code...
Read more >
Locally-run tests pass, but Jenkins tests fail; why, and how can ...
1 Answer 1 · The most common might be that the jenkins system is running slower, and your tests aren't being hyper-vigilant about...
Read more >
Tutorial: Deploying a Hello World application
In this guide, you download, build, and deploy a sample Hello World application using AWS SAM. You then test the application in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found