Module not found

I’m getting “Module not found” errors for my Travis CI build:

import requests

url_ddg = "https://api.duckduckgo.com"


def test_ddg0():
    resp = requests.get(url_ddg + "/?q=DuckDuckGo&format=json")
    rsp_data = resp.json()
    assert "DuckDuckGo" in rsp_data["Heading"]

My travis.yml file contains this following code:

language: python
python:
 - "3.8.2"
 - "nightly"
install:
 - "pip install pytest"
 - "pip install -r requirements.txt"
script: python -m pytest Test.py

My requirements.txt file contains this:

pytest==4.6

I’m thinking that the requests module is not apart of your requirements.txt? If not, that’s the problem. On occasion requests is sometimes installed by default, but not usually in Linux distributions, so add requests to your requirements.txt so your requirements.txt file would look like this:

pytest==4.6
requests~=2.6.0
1 Like

this did it @montana, thanks!

No problem.