Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unittest installation error Could not find a version that satisfies the requirement

Tags:

Could someone please help me with this error message:

Could not find a version that satisfies the requirement unittest 

I installed the latest Python and PyCharm and try to install the package unittest but get the above error. So far my experience with Python is a bit like dll hell ...

like image 678
cs0815 Avatar asked Sep 09 '17 17:09

cs0815


People also ask

How do I run a Unittest in Python?

The command to run the tests is python -m unittest filename.py . In our case, the command to run the tests is python -m unittest test_utils.py .

Could not find the version that satisfies the requirement PIP?

Solution 1: Just update pip You just need to update pip and your error will be resolve. Just follow this command. If you are windows users Then run this command. And then also upgrade setuptools after doing the above.

Which is better Pytest or Unittest?

Which is better – pytest or unittest? Although both the frameworks are great for performing testing in python, pytest is easier to work with. The code in pytest is simple, compact, and efficient. For unittest, we will have to import modules, create a class and define the testing functions within that class.


1 Answers

If you tried this:

$ pip install unittest Collecting unittest    Could not find a version that satisfies the requirement unittest (from versions: ) No matching distribution found for unittest 

It's normal to have an error because unittest is not a valid package on Pypi. The only distributable is unittest2-0.0.0.tar.gz but the name is not correct, it should be unittest-0.0.0.tar.gz (without "2"). In fact I think it's an error and if you want to use this one you need to install unittest2 (which is a backport of unittest for Python 2.6).

But unittest is a standard module, which you don't need to install:

$ python -m unittest  ---------------------------------------------------------------------- Ran 0 tests in 0.000s  OK 
like image 67
Laurent LAPORTE Avatar answered Sep 18 '22 12:09

Laurent LAPORTE