Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add requirements.txt to pg_probackup2 #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

demonolock
Copy link
Contributor

No description provided.

@dmitry-lipetsk
Copy link
Collaborator

Виктория

Я думаю нам нужен корневой requirements.txt с прописыванием внешних модулей, необходимых для разработки. Ну или готовый sh для инициализации окружения (я именно такой вариант и использую):

create_py_env.sh:

virtualenv venv
source venv/bin/activate
# pip install -U .
pip install flake8
pip install pytest
pip install pytest-xdist
pip install psycopg2
pip install six
pip install psutil

И здесь нужно прописать путь до собственного каталога testgres.

Чтобы можно было выполнить инициализацию (виртуального) окружения и потом без проблем запускать как тесты самого testgres так и тесты плагина для пробакапа.

Если testgres будет здесь прописан как модуль, то наверное и его собственные тесты могут подключать его по-человечески, а не через косвенные пути (как это сделано сейчас).

@dmitry-lipetsk
Copy link
Collaborator

Привет.

Я разобрался с той проблемой в плагине

====== ERRORS ======
_______ ERROR collecting testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py _______
ImportError while importing test module '/home/dima/MY/GitHub2/testgres/master/work01py3_8/testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/home/dima/.pyenv/versions/3.12.1/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
testgres/plugins/__init__.py:2: in <module>
    from .pg_probackup2.pg_probackup2.app import ProbackupApp, ProbackupException
testgres/plugins/pg_probackup2/pg_probackup2/app.py:12: in <module>
    import testgres
E   ModuleNotFoundError: No module named 'testgres'
====== short test summary info ======
ERROR testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py
====== 267 passed, 3 skipped, 1 error in 318.20s (0:05:18) ======

Она лечится с помощью переменной окружения PYTHONPATH:

export PYTHONPATH=<путь до каталога с проектом testgres>

Я этот трюк увидел в run_tests.py и понял что к чему )

Так что если этот requirements.txt добавлялся из-за этой проблемы, то он уже получается не нужен.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants