Pipenv gets blocked while running with Docker in Gitlab

As mentioned in another answer defining an empty CI variable will solve the build stuck issue.

Then the second issue that you will face due to not finding pytest and this is because the docker image is missing which package and this makes pipenv not able to find pytest.

The final gitlab-ci.yml file should be similar to the following:

image: peque/python-devel

variables:
  CI: ""

before_script:
  - pipenv sync --dev
  - yum install -y which

python36:
  script:
    - pipenv run pytest

And the final output will be:

$ pipenv run pytest
============================= test session starts ==============================
platform linux -- Python 3.7.2, pytest-4.3.0, py-1.8.0, pluggy-0.9.0
rootdir: /builds/mostafahussein/deleteme, inifile:
collected 0 items

========================= no tests ran in 0.01 seconds =========================


Regarding this issue:

termios.error: (25, 'Inappropriate ioctl for device')

This is because pipenv shell needs a tty to run without raising the above error however GitLab CI does not provide a tty since there are no user inputs as far as i know. So it will be better to use the first method which is pipenv run.