Unit tests not working on new forks: Error refers to installation of git-python

Problem description:
New forks of projects that previously worked fine are now problematic because unit tests don’t work any more. I am using Replit Teams for Education

Expected behavior:
The projects affected are ones that students have previously forked without having problems with the unit tests. I would expect the unit tests to work correctly in new tests as well.

Actual behavior:
When the students try to run unit tests on new forks an error message containing the following text occurs

  RuntimeError

  Unable to find installation candidates for git-python (1.1.1)

  at venv/lib/python3.8/site-packages/poetry/installation/chooser.py:72 in choose_for
       68│ 
       69│             links.append(link)
       70│ 
       71│         if not links:
    →  72│             raise RuntimeError(
       73│                 "Unable to find installation candidates for {}".format(package)
       74│             )
       75│ 
       76│         # Get the best link


Failed to add packages, reverting the pyproject.toml file to its original content.
exit status 1

Steps to reproduce:
I am not sure how to reproduce this bug because it occurs on new forks of projects that previously worked correctly.

Bug appears at this link:
Am using Replit Teams for Education and can’t provide a public link.

Browser: Chrome, Firefox.
OS: Windows 11
Device (Android, iOS, NA leave blank): OC
Desktop app version (Avatar menu->“Version”) or NA:
Plan (Free, Hacker, Pro Plan): Replit Teams for Education

1 Like

I can also confirm this issue. I am using Teams for education and newly forked projects are also producing this error.

I am trying to use the timeout_decorator and when it tries to install this it is also trying to install git-python (1.1.1.) which results in an error.

You can reproduce this by adding import timeout-decorator in the setup of the unit tests.

I suspect this would be the same for any package that needs installing via poetry and is triggering git-python (1.1.1) to be installed.

This is quite critical as students are doing these projects as we speak as part of their assessed work.

Thanks,

Sam

1 Like

I believe I am having the same problem:

I’m experiencing the same issue. My students can run their code but not the unit tests.

In my case, I have written some utility code which I import in the setup of the unit tests. I am not sure that the Replit framework understands that it is code that I have written myself, rather than code that needs to be imported from an external repository.

Hello all,
could one of you provide a link to a public fork of the repl?
I noticed that the repls seem to be running on old configuration, which may cause some problems. I know that Unit Tests used to not work, with a workaround being to use the old configuration.

Try using the newer templates to avoid problems. A small fix is needed to enable Unit Tests on the newer templates:
Show hidden files by clicking three dots and then clicking Show hidden files,
then open .replit file, then insert this at the bottom of the file:

[unitTest]
language = "python"

I have noticed that commenting out the line
guessImports = true
in the .replit file seems to fix the problem. It appears in the [packager.features] section.

However I am having difficulty recreating this problem on a public repl. The projects that I create on Teams for Education are not really meant to be shared outside my university, and when I create a public repl in an attempt to duplicate the issue, it doesn’t reappear.

P.S. The problem is NOT related to the [unitTest] section you mentioned. The line you quote is in the .replit file. As I said, it might be related to guessImports = true

It is strange that removing that line fixes the issue, because that specific configuration has been outdated and not working for a while.
The newer, correct configuration (which should still work on old repls) is:

disableGuessImports = true

so you could try that.

When you are recreating the problem, are you forking the problem repl and stripping what’s unnecessary?

Hi. Do you mean that I should replace guessImport = true with disableGuessImport = true

And is it possible to create a public fork of a Teams for Education project. I can’t see how you do it?

My bad, I mean that one could put disableGuessImports = true by itself near the top of the file.
I do not know if it is possible to create a public fork, a google search yields:

saying one would fork the repl into their own account (outside of the team), via the Owner option.

Adding disableGuessImports = true as a line by itself doesn’t fix the problem. But commenting out guessImports = true does seem to work. It’s midnight in the UK right now, and I have teaching first thing in the morning, so I guess I’ll just have to do the commenting out and hope for the best tomorrow!

Do note that this should not be placed under anything. Put it directly below entrypoint.

While commenting guessImports = true does work in cases where you are not trying to import a module that isn’t installed.

It does not work when you are trying to use a module that needs installing. For example, I am using the timeout_decoratormodule in my unit tests.

Alternatively, I added git-python to the ignoredPackages list which also resolves the issue. Set guessImports = true. Then the module will be installed but it will not install git-python.

image

@samtoneill Could you try what I suggested above and tell if that works?

I replaced guessImports = true with disableGuessImports = true and now the unit tests work again. :slight_smile:

  1. disableGuessImports = true does not work if you then have guessImports = true. It appears to override it.

  2. guessImports = false or commented out works in some instances, but not in those where other packages do need installing. It does not require disableGuessImports = true. Are they similar flags?

  3. Adding “git-python” to the ignoredPackages list works in all cases for me. In some config files I have this comment # Never attempt to install `unit_tests`. If there are packages that are being guessed wrongly, add them here.

It appears that git-python is being guessed wrongly and that there is an issue with it’s install, so adding it to the ignoredPackages appears to stop this install, but does not stop other packages being guessed.

For points 1 and 2, they should be used as a ‘this or that’. You can’t use both.
Also, disableGuessImports was newly released, so the others may not work (which seems to not be the case).

I’ll give everything another test and report back. I had to get a fix sorted asap and no 3. worked for all my cases.

Appreciate the help from folks as I didn’t have the time to work out where to start. :slight_smile:

2 Likes