Unable to run the test

I tested my program correctly. But if I use input/output test , it fails.

Here are the error statements:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
1 Like

Welcome to the forums!

Unfortunately, we’re not able to help you without the code and the full error message, or the Repl.

1 Like

I tried creating a new project last night and this evening to have the same problem. the code runs, but when I use the test, can run it fails and doesn’t show any input or output. Even tried “exact match” and it still doesn’t work.

Simple code to print out odd indexed characters, failing tests I produced from the code itself : >

Output every other character from an input string (odd number indexed chars)

Read in a string

quote = input("Quote: ")

newChars = “”

loop through the string for the length of the string

output the odd characters

for i in range(len(quote)):
if i%2:
newChars += quote[i]
print(newChars)

Here is the program. A very simple one.
image

This is the result:
image

My test case
image

It’s recommended to use f-strings in Python 3.6+.

print(f"Hi, {name}.")

Make sure to add “f” before the string or it won’t work.

If i run the program, it works. But when i use the test tool, it fails.

same here T_T
That’s should be the test tool problem…but don’t know how to fix it.

I think there’s an issue with the test tool, or maybe you’re using it wrong.

Anyway, that code works on Python, even if the test tool says it doesn’t.

I found this post might help. It said it is the problem of new template, however I clicked the link provided, it said the post is gone or private.
https://ask.replit.com/t/testing-using-inputs-and-outputs/63194/7

https://ask.replit.com/t/tests-not-working/60902/11?u=firepup650

Folks Replit was made aware of this at the beginning of September and still hasn’t fixed it.
See post here: Help with a simple test
The current workaround is to have students copy the UNCORRUPTED .replit file to each and every new repl. They will need to open the hidden files and copy and paste in the proper UNCORRUPTED .replit file:

Here it is in case you don’t have a working copy:


## COPY BELOW HERE ##

# The command that runs the program. If the interpreter field is set, it will have priority and this run command will do nothing
run = ["python3", "main.py"]

entrypoint = "main.py"
# A list of globs that specify which files and directories should
# be hidden in the workspace.
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"]

# Specifies which nix channel to use when building the environment.
[nix]
channel = "stable-22_11"

[[hints]]
regex = "stderred: .+GLIBC.+not found"
message = "The command `stderred` is known to cause issues. It's recommended you remove it from your .replit configuration."

# The command to start the interpreter.
[interpreter.command]
args = [
  "prybar-python3",
  "-q",
  "--ps1",
  "\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",
  "-i",
]
env = { LD_LIBRARY_PATH = "$PYTHON_LD_LIBRARY_PATH" }

[env]
VIRTUAL_ENV = "/home/runner/${REPL_SLUG}/venv"
PATH = "${VIRTUAL_ENV}/bin"
PYTHONPATH = "$PYTHONHOME/lib/python3.8:${VIRTUAL_ENV}/lib/python3.8/site-packages"
REPLIT_POETRY_PYPI_REPOSITORY = "https://package-proxy.replit.com/pypi/"
MPLBACKEND = "TkAgg"
POETRY_CACHE_DIR = "${HOME}/${REPL_SLUG}/.cache/pypoetry"

# Enable unit tests. This is only supported for a few languages.
[unitTest]
language = "python3"

# Add a debugger!
[debugger]
support = true

  # How to start the debugger.
  [debugger.interactive]
  transport = "localhost:0"
  startCommand = ["dap-python", "main.py"]

    # How to communicate with the debugger.
    [debugger.interactive.integratedAdapter]
    dapTcpAddress = "localhost:0"

    # How to tell the debugger to start a debugging session.
    [debugger.interactive.initializeMessage]
    command = "initialize"
    type = "request"

      [debugger.interactive.initializeMessage.arguments]
      adapterID = "debugpy"
      clientID = "replit"
      clientName = "replit.com"
      columnsStartAt1 = true
      linesStartAt1 = true
      locale = "en-us"
      pathFormat = "path"
      supportsInvalidatedEvent = true
      supportsProgressReporting = true
      supportsRunInTerminalRequest = true
      supportsVariablePaging = true
      supportsVariableType = true

    # How to tell the debugger to start the debuggee application.
    [debugger.interactive.launchMessage]
    command = "attach"
    type = "request"

      [debugger.interactive.launchMessage.arguments]
      logging = {}

# Configures the packager.
[packager]
language = "python3"
ignoredPackages = ["unit_tests"]

  [packager.features]
  enabledForHosting = false
  # Enable searching packages from the sidebar.
  packageSearch = true
  # Enable guessing what packages are needed from the code.
  guessImports = true

# These are the files that need to be preserved when this
# language template is used as the base language template
# for Python repos imported from GitHub
[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config", "venv"]

[languages]

[languages.python3]
pattern = "**/*.py"

[languages.python3.languageServer]
start = "pylsp"

[deployment]
run = ["sh", "-c", "python3 main.py"]

Also note, this hasn’t fixed the issue with the differences displaying properly. That is still not working and I don’t have a work around for that but at least the auto-grader has the tests passing and you can sort of figure out issues (missing or extra spaces are a pain though especially when you don’t know what line they’re on)