Hi Jonathan,
This is a compatibility issue between pytest versions – you’ll need version 6.0 or newer.
In aiida-core, we keep track of the testing dependencies through the “tests” extra requirement: https://github.com/aiidateam/aiida-core/blob/d35a9d7905d8d94c35b6e6eebaae2e5440fec975/setup.json#L104
However, that also includes dependencies that are specific to the aiida-core tests themselves, and not required to use the fixtures that aiida-core provides. Maybe that is something to be improved.
Best,
Dominik
--
AiiDA is supported by the NCCR MARVEL (http://nccr-marvel.ch/),
funded by the Swiss National Science Foundation, and by the European H2020 MaX Centre of Excellence (http://www.max-centre.eu/).
Before posting your first question, please see the posting guidelines at
http://www.aiida.net/?page_id=356 .
---
You received this message because you are subscribed to the Google Groups "aiidausers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
aiidausers+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/aiidausers/612aaddf-99f3-47a8-9664-bbdf64ca8f92n%40googlegroups.com.
$ pip listPackage Version--------------------- ---------aiida-core 1.6.0aiida-pseudo 0.5.0aiida-quantumespresso 3.4.0aiida-vasp 2.1.0aio-pika 6.8.0aiormq 3.3.1aldjemy 0.9.1alembic 1.5.8appdirs 1.4.4archive-path 0.2.1ase 3.21.1asn1crypto 1.4.0astroid 2.5async-generator 1.10attrs 20.3.0backcall 0.2.0bcrypt 3.2.0certifi 2020.12.5cffi 1.14.5cfgv 3.2.0chardet 4.0.0circus 0.17.1click 7.1.2click-completion 0.5.2click-config-file 0.6.0click-spinner 0.1.10configobj 5.0.6coverage 5.5cryptography 3.4.7cycler 0.10.0decorator 4.4.2deprecation 2.1.0distlib 0.3.1Django 2.2.19elementpath 2.2.1ete3 3.1.2filelock 3.0.12future 0.18.2graphviz 0.16icet 1.3identify 2.2.2idna 2.10iniconfig 1.1.1ipython 7.22.0ipython-genutils 0.2.0isort 4.3.21jedi 0.18.0Jinja2 2.11.3joblib 1.0.1jsonschema 3.2.0kiwipy 0.7.4kiwisolver 1.3.1lazy-object-proxy 1.6.0lxml 4.6.3Mako 1.1.4MarkupSafe 1.1.1matplotlib 3.4.0mccabe 0.6.1monty 2021.3.3mpmath 1.2.1multidict 5.1.0mypy 0.790mypy-extensions 0.4.3nest-asyncio 1.4.3networkx 2.5nodeenv 1.5.0numpy 1.20.2packaging 20.3palettable 3.3.0pamqp 2.3.0pandas 1.2.3paramiko 2.7.2parsevasp 2.0.1parso 0.8.1pexpect 4.8.0pg8000 1.19.0pgsu 0.2.0pgtest 1.3.2pickleshare 0.7.5Pillow 8.1.2pip 21.0.1plotly 4.14.3pluggy 0.13.1plumpy 0.19.0pre-commit 2.11.1prompt-toolkit 3.0.18psutil 5.8.0psycopg2-binary 2.8.6ptyprocess 0.7.0py 1.10.0py-cpuinfo 7.0.0pybind11 2.6.2PyCifRW 4.4.2pycparser 2.20Pygments 2.8.1pylint 2.5.3pylint-django 2.3.0pylint-plugin-utils 0.6pymatgen 2020.12.3Pympler 0.9PyMySQL 0.9.3PyNaCl 1.4.0pyparsing 2.4.7pyrsistent 0.17.3pytest 6.2.2pytest-asyncio 0.14.0pytest-benchmark 3.2.3pytest-cov 2.11.1pytest-rerunfailures 9.1.1pytest-timeout 1.4.2python-dateutil 2.8.1python-editor 1.0.4pytray 0.3.1pytz 2019.3PyYAML 5.1.2pyzmq 22.0.3qe-tools 2.0.0rc2reentry 1.3.2requests 2.25.1retrying 1.3.3ruamel.yaml 0.17.2ruamel.yaml.clib 0.2.2scikit-learn 0.24.1scipy 1.6.2scramp 1.3.0seekpath 1.9.7setuptools 54.1.2shellingham 1.4.0shortuuid 1.0.1simplejson 3.17.2six 1.15.0spglib 1.16.1SQLAlchemy 1.3.23SQLAlchemy-Utils 0.36.8sqlparse 0.4.1subprocess32 3.5.4sympy 1.7.1tabulate 0.8.9threadpoolctl 2.1.0toml 0.10.2tomlkit 0.7.0tornado 6.1tqdm 4.59.0traitlets 5.0.5typed-ast 1.4.2typing-extensions 3.7.4.3tzlocal 2.1uncertainties 3.1.5upf-to-json 0.9.3urllib3 1.26.4virtualenv 20.4.3voluptuous 0.12.1wcwidth 0.2.5wheel 0.36.2wrapt 1.11.2xmlschema 1.5.3yapf 0.30.0yarl 1.6.3$ AIIDA_TEST_PROFILE=test_relax LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' pytest -q tests/relaxation/test_relaxation_vasp.pyE [100%]==================================== ERRORS ====================================_______________________ ERROR at setup of test_relax_wc ________________________aiida_profile = <aiida.manage.tests.TestManager object at 0x7fc656e84040> @pytest.fixture() def fresh_aiida_env(aiida_profile): """Reset the database before and after the test function."""> print('The root directory of the fixture manager is: {}'.format(aiida_profile._manager.root_dir)) # pylint: disable=protected-accessE AttributeError: 'ProfileManager' object has no attribute 'root_dir'aiida_env/lib/python3.8/site-packages/aiida_vasp/utils/fixtures/environment.py:19: AttributeError=============================== warnings summary ===============================aiida_env/lib/python3.8/site-packages/past/builtins/misc.py:45 /builds/cdpm/aiida-coro/aiida_env/lib/python3.8/site-packages/past/builtins/misc.py:45: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses from imp import reloadaiida_env/lib/python3.8/site-packages/monty/serialization.py:81: 17 warnings /builds/cdpm/aiida-coro/aiida_env/lib/python3.8/site-packages/monty/serialization.py:81: PendingDeprecationWarning: load will be removed, use yaml=YAML(typ='unsafe', pure=True) yaml.load(...) instead return yaml.load(fp, *args, **kwargs)
As you see, I guess due to the change in version of some packages, some new warnings show up, but everything else is basically the same.
Cheers
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/DBAPR83MB03908860744DF2C6BD0AAD93857D9%40DBAPR83MB0390.EURPRD83.prod.outlook.com.
Hi Jonathan,
I had confused your error message with a very similar one -- indeed it seems the pytest version is not involved.
From my testing, it seems this error occurs only when an AIIDA_TEST_PROFILE is set, not when using a temporary test profile. That may explain why the aiida-vasp CI is working.
In principle the aiida_profile._manager is an internal variable, so we shouldn’t rely on its behavior. I’d still suggest opening an issue with aiida-core to discuss if the missing root_dir is intentional or a bug, though.
Maybe the fresh_aiida_env fixture should also be updated to either not rely on the _manager, or fail gracefully when root_dir is not present.
Best,
Dominik
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/CAO8p0kUAacxPmvEAFp%3D1Xv2hHBdJbN_remv9PMbcZKwTBYjo4Q%40mail.gmail.com.
==================================== ERRORS ====================================_______________________ ERROR at setup of test_relax_wc ________________________ @pytest.fixture(scope='session', autouse=True) def aiida_profile(): """Set up AiiDA test profile for the duration of the tests. Note: scope='session' limits this fixture to run once per session. Thanks to ``autouse=True``, you don't actually need to depend on it explicitly - it will activate as soon as you import it in your ``conftest.py``. """> with test_manager(backend=get_test_backend_name(), profile_name=get_test_profile_name()) as manager:aiida_env/lib/python3.8/site-packages/aiida/manage/tests/pytest_fixtures.py:45: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/local/lib/python3.8/contextlib.py:113: in __enter__ return next(self.gen)aiida_env/lib/python3.8/site-packages/aiida/manage/tests/__init__.py:460: in test_manager _GLOBAL_TEST_MANAGER.use_temporary_profile(backend=backend, pgtest=pgtest)aiida_env/lib/python3.8/site-packages/aiida/manage/tests/__init__.py:92: in use_temporary_profile mngr.create_profile()aiida_env/lib/python3.8/site-packages/aiida/manage/tests/__init__.py:330: in create_profile self.create_aiida_db()aiida_env/lib/python3.8/site-packages/aiida/manage/tests/__init__.py:311: in create_aiida_db self.create_db_cluster()aiida_env/lib/python3.8/site-packages/aiida/manage/tests/__init__.py:301: in create_db_cluster self.pg_cluster = PGTest(**self._pgtest)aiida_env/lib/python3.8/site-packages/pgtest/pgtest.py:341: in __init__ self._init_base_dir()_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = PGTest(database='postgres', username='postgres', port=41707, log_file='/tmp/tmpg4o0x_ct/pgtest_log.txt', no_cleanup=False, copy_cluster=None, cluster='/tmp/tmpg4o0x_ct', pg_ctl='/usr/lib/postgresql/11/bin/pg_ctl') def _init_base_dir(self): """Initiates the base directory and creates a cluster, either brand new or by copying the cluster defined by the user """ try: if self._copy_cluster: shutil.rmtree(self._cluster) shutil.copytree(self._copy_cluster, self._cluster) else: cmd = ('"{pg_ctl}" initdb -D "{cluster}" -o "-U {username} -A ' 'trust"').format(pg_ctl=self._pg_ctl_exe, cluster=self._cluster, username=self._username) proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) _, err = proc.communicate() if err:> raise IOError(err)E OSError: b'pg_ctl: cannot be run as root\nPlease log in (using, e.g., "su") as the (unprivileged) user that will\nown the server process.\n'aiida_env/lib/python3.8/site-packages/pgtest/pgtest.py:513: OSError
This seems to be an error related to how one sets up postgres in Gitlab, it seems to be that due to the differences between Gitlab and Github, at least as far as I can tell.
I'll make the bug report in aiida-core and perhaps I'll link it in aiida-vasp.
Thanks
Cheers
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/DBAPR83MB039073200AC68E2887A047FD857D9%40DBAPR83MB0390.EURPRD83.prod.outlook.com.
Hi Jonathan,
Yes, I think you’re right. The way I interpret this error message is that at the time the tests are executed, you’re logged into the instance as root. That could well be different on GitHub vs. Gitlab. Not sure if there’s a way to change it.
Just to give some context on what’s happening when you don’t define an AIIDA_TEST_PROFILE: In order to not affect the “normal” database, the tests create a new temporary “database cluster”. The pgtest library takes care of this process.
Best,
Dominik
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/CAO8p0kVxkx6gxkT93nuk%2B0mC1Kd5XrjeqZv_hrEYgMu6sKatrQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/DBAPR83MB0390F431E2B79F036F3C5C04857D9%40DBAPR83MB0390.EURPRD83.prod.outlook.com.