wazuh / wazuh-qa

Wazuh - Quality Assurance
GNU General Public License v2.0
65 stars 32 forks source link

Adapt QA framework requirements for python3.10 #2991

Closed Rebits closed 2 years ago

Rebits commented 2 years ago

Description

New nodes and instances are provided with python3.10.4. However, the current requirement file fails to install jq:

      jq.c:12085:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      12085 |             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
            |                 ^
      jq.c:12090:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      12090 |             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
            |                 ^
      jq.c: In function ‘__Pyx_Generator_Next’:
      jq.c:12174:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      12174 |             ret = _PyGen_Send((PyGenObject*)yf, NULL);
            |                 ^
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for jq
Failed to build jq
ERROR: Could not build wheels for jq, which is required to install pyproject.toml-based projects

Full error: output.zip

It is required to include some logic to install libraries depending on the python version. We could use the python_version environment makers

fedepacher commented 2 years ago

Update 2022/06/22

In order to test Wazuh-QA test with the version of Python (3.10.4) installed in the node and instances deployed with the pipeline Deployer it must replace the following marker in the jq and pytest package:

jq==1.1.2 ; platform_system == "Linux" or platform_system == "Darwin"

Replace by:

jq==1.1.2 ; (platform_system == "Linux" or platform_system == "Darwin") and python_version <= "3.9"
jq==1.2.2 ; python_version >= "3.10"

And

pytest==6.2.2

Replace by:

pytest==6.2.2 ; python_version <= "3.9"
pytest==7.1.2 ; python_version >= "3.10"

Ubuntu

Install requirements.txt

python3 -m pip install -r requirements.txt

Output

WARNING: There was an error checking the latest version of pip.

Solution

python3 -m pip install --upgrade pip

After upgrading pip the requirements.txt was installed again and the output was:

Output ``` Defaulting to user installation because normal site-packages is not writeable Ignoring jq: markers '(platform_system == "Linux" or platform_system == "Darwin") and python_version < "3.9"' don't match your environment Ignoring wmi: markers 'platform_system == "Windows"' don't match your environment Ignoring libcst: markers 'python_version <= "3.6"' don't match your environment Requirement already satisfied: configobj==5.0.6 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (5.0.6) Requirement already satisfied: certifi==2020.12.5 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (2020.12.5) Requirement already satisfied: cffi>=1.14.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (1.15.0) Requirement already satisfied: cycler>=0.10 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 4)) (0.11.0) Requirement already satisfied: bcrypt==3.2.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 5)) (3.2.0) Requirement already satisfied: distro==1.3.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 6)) (1.3.0) Requirement already satisfied: filetype==1.0.7 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 7)) (1.0.7) Requirement already satisfied: freezegun==0.3.15 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 8)) (0.3.15) Requirement already satisfied: grpcio>=1.27.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 9)) (1.46.3) Requirement already satisfied: google-cloud-pubsub==2.3.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 10)) (2.3.0) Requirement already satisfied: jsonschema==3.2.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 11)) (3.2.0) Requirement already satisfied: kiwisolver>=1.0.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 12)) (1.4.3) Requirement already satisfied: lockfile==0.12.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 13)) (0.12.2) Requirement already satisfied: matplotlib>=3.3.4 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 14)) (3.5.2) Requirement already satisfied: netifaces==0.10.9 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 15)) (0.10.9) Requirement already satisfied: numpy>=1.18.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 16)) (1.22.4) Requirement already satisfied: pandas>=1.1.5 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 17)) (1.4.2) Requirement already satisfied: pillow>=6.2.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 18)) (9.1.1) Requirement already satisfied: psutil>=5.6.6 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 19)) (5.9.1) Requirement already satisfied: py~=1.10.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 20)) (1.10.0) Requirement already satisfied: pycryptodome>=3.9.8 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 21)) (3.14.1) Requirement already satisfied: pyOpenSSL==19.1.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 22)) (19.1.0) Requirement already satisfied: pytest-html==3.1.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 23)) (3.1.1) Requirement already satisfied: pytest==6.2.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 24)) (6.2.2) Requirement already satisfied: pyyaml==5.4 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 25)) (5.4) Requirement already satisfied: requests==2.23.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 26)) (2.23.0) Requirement already satisfied: scipy>=1.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 27)) (1.8.1) Requirement already satisfied: seaborn>=0.11.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 28)) (0.11.2) Requirement already satisfied: setuptools~=56.0.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 29)) (56.0.0) Requirement already satisfied: testinfra==5.0.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 30)) (5.0.0) Requirement already satisfied: jq==1.2.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 32)) (1.2.2) Requirement already satisfied: cryptography==3.3.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 33)) (3.3.2) Requirement already satisfied: urllib3 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 34)) (1.25.11) Requirement already satisfied: numpydoc>=1.1.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 35)) (1.4.0) Requirement already satisfied: ansible-runner>=2.0.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 36)) (2.2.1) Requirement already satisfied: docker>=5.0.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 37)) (5.0.3) Requirement already satisfied: python-vagrant>=0.5.15 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 38)) (1.0.0) Requirement already satisfied: ansible>=3.1.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 39)) (6.0.0) Requirement already satisfied: elasticsearch>=7.14.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 40)) (7.17.4) Requirement already satisfied: safety==1.10.3 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 41)) (1.10.3) Requirement already satisfied: bandit==1.7.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 42)) (1.7.0) Requirement already satisfied: git-repo==1.10.3 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 43)) (1.10.3) Requirement already satisfied: pywinrm>=0.4.2 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 44)) (0.4.3) Requirement already satisfied: deepdiff==5.6.0 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 46)) (5.6.0) Requirement already satisfied: treelib==1.6.1 in /home/qa/.local/lib/python3.10/site-packages (from -r requirements.txt (line 48)) (1.6.1) Requirement already satisfied: six in /usr/lib/python3/dist-packages (from freezegun==0.3.15->-r requirements.txt (line 8)) (1.16.0) Requirement already satisfied: python-dateutil!=2.0,>=1.0 in /home/qa/.local/lib/python3.10/site-packages (from freezegun==0.3.15->-r requirements.txt (line 8)) (2.8.2) Requirement already satisfied: grpc-google-iam-v1<0.13dev,>=0.12.3 in /home/qa/.local/lib/python3.10/site-packages (from google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.12.4) Requirement already satisfied: proto-plus>=1.7.1 in /home/qa/.local/lib/python3.10/site-packages (from google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (1.20.6) Requirement already satisfied: google-api-core[grpc]<2.0.0dev,>=1.22.2 in /home/qa/.local/lib/python3.10/site-packages (from google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (1.31.6) Requirement already satisfied: libcst>=0.3.10 in /home/qa/.local/lib/python3.10/site-packages (from google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.4.5) Requirement already satisfied: pytest-metadata in /home/qa/.local/lib/python3.10/site-packages (from pytest-html==3.1.1->-r requirements.txt (line 23)) (2.0.1) Requirement already satisfied: attrs>=19.2.0 in /usr/lib/python3/dist-packages (from pytest==6.2.2->-r requirements.txt (line 24)) (21.2.0) Requirement already satisfied: pluggy<1.0.0a1,>=0.12 in /home/qa/.local/lib/python3.10/site-packages (from pytest==6.2.2->-r requirements.txt (line 24)) (0.13.1) Requirement already satisfied: iniconfig in /home/qa/.local/lib/python3.10/site-packages (from pytest==6.2.2->-r requirements.txt (line 24)) (1.1.1) Requirement already satisfied: packaging in /home/qa/.local/lib/python3.10/site-packages (from pytest==6.2.2->-r requirements.txt (line 24)) (21.3) Requirement already satisfied: toml in /home/qa/.local/lib/python3.10/site-packages (from pytest==6.2.2->-r requirements.txt (line 24)) (0.10.2) Requirement already satisfied: idna<3,>=2.5 in /home/qa/.local/lib/python3.10/site-packages (from requests==2.23.0->-r requirements.txt (line 26)) (2.10) Requirement already satisfied: chardet<4,>=3.0.2 in /home/qa/.local/lib/python3.10/site-packages (from requests==2.23.0->-r requirements.txt (line 26)) (3.0.4) Requirement already satisfied: Click>=6.0 in /usr/lib/python3/dist-packages (from safety==1.10.3->-r requirements.txt (line 41)) (8.0.3) Requirement already satisfied: dparse>=0.5.1 in /home/qa/.local/lib/python3.10/site-packages (from safety==1.10.3->-r requirements.txt (line 41)) (0.5.1) Requirement already satisfied: stevedore>=1.20.0 in /home/qa/.local/lib/python3.10/site-packages (from bandit==1.7.0->-r requirements.txt (line 42)) (3.5.0) Requirement already satisfied: GitPython>=1.0.1 in /home/qa/.local/lib/python3.10/site-packages (from bandit==1.7.0->-r requirements.txt (line 42)) (3.1.27) Requirement already satisfied: pybitbucket-fork>=0.12.2 in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (0.12.2) Requirement already satisfied: gogs-client>=1.0.3 in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (1.0.6) Requirement already satisfied: docopt in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (0.6.2) Requirement already satisfied: lxml in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (4.9.0) Requirement already satisfied: github3.py<1.0.0 in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (0.9.6) Requirement already satisfied: progress in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (1.6) Requirement already satisfied: python-gitlab>=1.0.0 in /home/qa/.local/lib/python3.10/site-packages (from git-repo==1.10.3->-r requirements.txt (line 43)) (2.10.0) Requirement already satisfied: ordered-set==4.0.2 in /home/qa/.local/lib/python3.10/site-packages (from deepdiff==5.6.0->-r requirements.txt (line 46)) (4.0.2) Requirement already satisfied: future in /home/qa/.local/lib/python3.10/site-packages (from treelib==1.6.1->-r requirements.txt (line 48)) (0.18.2) Requirement already satisfied: pycparser in /home/qa/.local/lib/python3.10/site-packages (from cffi>=1.14.0->-r requirements.txt (line 3)) (2.21) Requirement already satisfied: pyparsing>=2.2.1 in /usr/lib/python3/dist-packages (from matplotlib>=3.3.4->-r requirements.txt (line 14)) (2.4.7) Requirement already satisfied: fonttools>=4.22.0 in /home/qa/.local/lib/python3.10/site-packages (from matplotlib>=3.3.4->-r requirements.txt (line 14)) (4.33.3) Requirement already satisfied: pytz>=2020.1 in /usr/lib/python3/dist-packages (from pandas>=1.1.5->-r requirements.txt (line 17)) (2022.1) Requirement already satisfied: Jinja2>=2.10 in /usr/lib/python3/dist-packages (from numpydoc>=1.1.0->-r requirements.txt (line 35)) (3.0.3) Requirement already satisfied: sphinx>=3.0 in /home/qa/.local/lib/python3.10/site-packages (from numpydoc>=1.1.0->-r requirements.txt (line 35)) (5.0.2) Requirement already satisfied: pexpect>=4.5 in /usr/lib/python3/dist-packages (from ansible-runner>=2.0.1->-r requirements.txt (line 36)) (4.8.0) Requirement already satisfied: python-daemon in /home/qa/.local/lib/python3.10/site-packages (from ansible-runner>=2.0.1->-r requirements.txt (line 36)) (2.3.0) Requirement already satisfied: websocket-client>=0.32.0 in /home/qa/.local/lib/python3.10/site-packages (from docker>=5.0.0->-r requirements.txt (line 37)) (1.3.3) Requirement already satisfied: ansible-core~=2.13.0 in /home/qa/.local/lib/python3.10/site-packages (from ansible>=3.1.0->-r requirements.txt (line 39)) (2.13.1) Requirement already satisfied: xmltodict in /home/qa/.local/lib/python3.10/site-packages (from pywinrm>=0.4.2->-r requirements.txt (line 44)) (0.13.0) Requirement already satisfied: requests-ntlm>=1.1.0 in /home/qa/.local/lib/python3.10/site-packages (from pywinrm>=0.4.2->-r requirements.txt (line 44)) (1.1.0) Requirement already satisfied: resolvelib<0.9.0,>=0.5.3 in /home/qa/.local/lib/python3.10/site-packages (from ansible-core~=2.13.0->ansible>=3.1.0->-r requirements.txt (line 39)) (0.8.1) Requirement already satisfied: uritemplate.py>=0.2.0 in /home/qa/.local/lib/python3.10/site-packages (from github3.py<1.0.0->git-repo==1.10.3->-r requirements.txt (line 43)) (3.0.2) Requirement already satisfied: gitdb<5,>=4.0.1 in /home/qa/.local/lib/python3.10/site-packages (from GitPython>=1.0.1->bandit==1.7.0->-r requirements.txt (line 42)) (4.0.9) Requirement already satisfied: google-auth<2.0dev,>=1.25.0 in /home/qa/.local/lib/python3.10/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (1.35.0) Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /home/qa/.local/lib/python3.10/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (1.56.3) Requirement already satisfied: protobuf<4.0.0dev,>=3.12.0 in /home/qa/.local/lib/python3.10/site-packages (from google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (3.20.1) Requirement already satisfied: typing-extensions>=3.7.4.2 in /home/qa/.local/lib/python3.10/site-packages (from libcst>=0.3.10->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (4.2.0) Requirement already satisfied: typing-inspect>=0.4.0 in /home/qa/.local/lib/python3.10/site-packages (from libcst>=0.3.10->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.7.1) Requirement already satisfied: simplejson in /home/qa/.local/lib/python3.10/site-packages (from pybitbucket-fork>=0.12.2->git-repo==1.10.3->-r requirements.txt (line 43)) (3.17.6) Requirement already satisfied: requests-oauthlib in /home/qa/.local/lib/python3.10/site-packages (from pybitbucket-fork>=0.12.2->git-repo==1.10.3->-r requirements.txt (line 43)) (1.3.1) Requirement already satisfied: uritemplate in /home/qa/.local/lib/python3.10/site-packages (from pybitbucket-fork>=0.12.2->git-repo==1.10.3->-r requirements.txt (line 43)) (4.1.1) Requirement already satisfied: oauthlib in /usr/lib/python3/dist-packages (from pybitbucket-fork>=0.12.2->git-repo==1.10.3->-r requirements.txt (line 43)) (3.2.0) Requirement already satisfied: voluptuous in /home/qa/.local/lib/python3.10/site-packages (from pybitbucket-fork>=0.12.2->git-repo==1.10.3->-r requirements.txt (line 43)) (0.13.1) Requirement already satisfied: requests-toolbelt>=0.9.1 in /home/qa/.local/lib/python3.10/site-packages (from python-gitlab>=1.0.0->git-repo==1.10.3->-r requirements.txt (line 43)) (0.9.1) Requirement already satisfied: ntlm-auth>=1.0.2 in /home/qa/.local/lib/python3.10/site-packages (from requests-ntlm>=1.1.0->pywinrm>=0.4.2->-r requirements.txt (line 44)) (1.5.0) Requirement already satisfied: sphinxcontrib-qthelp in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.0.3) Requirement already satisfied: babel>=1.3 in /usr/lib/python3/dist-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (2.8.0) Requirement already satisfied: alabaster<0.8,>=0.7 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (0.7.12) Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.5 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.1.5) Requirement already satisfied: Pygments>=2.0 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (2.12.0) Requirement already satisfied: snowballstemmer>=1.1 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (2.2.0) Requirement already satisfied: sphinxcontrib-applehelp in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.0.2) Requirement already satisfied: docutils<0.19,>=0.14 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (0.18.1) Requirement already satisfied: imagesize in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.3.0) Requirement already satisfied: sphinxcontrib-devhelp in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.0.2) Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (2.0.0) Requirement already satisfied: sphinxcontrib-jsmath in /home/qa/.local/lib/python3.10/site-packages (from sphinx>=3.0->numpydoc>=1.1.0->-r requirements.txt (line 35)) (1.0.1) Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /home/qa/.local/lib/python3.10/site-packages (from stevedore>=1.20.0->bandit==1.7.0->-r requirements.txt (line 42)) (5.9.0) Requirement already satisfied: smmap<6,>=3.0.1 in /home/qa/.local/lib/python3.10/site-packages (from gitdb<5,>=4.0.1->GitPython>=1.0.1->bandit==1.7.0->-r requirements.txt (line 42)) (5.0.0) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/qa/.local/lib/python3.10/site-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (4.2.4) Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.2.1) Requirement already satisfied: rsa<5,>=3.1.4 in /home/qa/.local/lib/python3.10/site-packages (from google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (4.8) Requirement already satisfied: mypy-extensions>=0.3.0 in /home/qa/.local/lib/python3.10/site-packages (from typing-inspect>=0.4.0->libcst>=0.3.10->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.4.3) Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4->google-auth<2.0dev,>=1.25.0->google-api-core[grpc]<2.0.0dev,>=1.22.2->google-cloud-pubsub==2.3.0->-r requirements.txt (line 10)) (0.4.8) ```

Install QA framework

python3 setup.py install
Output ``` running install error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib/python3.10/dist-packages/test-easy-install-28859.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python3.10/dist-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/easy_install.html Please make the appropriate changes for your system and try again. ```

Solution

python3 setup.py install --user 

Running integration test :red_circle:

python3 -m pytest integration/
Output ``` Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/qa/.local/lib/python3.10/site-packages/pytest/__main__.py", line 5, in raise SystemExit(pytest.console_main()) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 185, in console_main code = main() File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 143, in main config = _prepareconfig(args, plugins) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "/home/qa/.local/lib/python3.10/site-packages/pluggy/hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "/home/qa/.local/lib/python3.10/site-packages/pluggy/manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "/home/qa/.local/lib/python3.10/site-packages/pluggy/manager.py", line 84, in self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "/home/qa/.local/lib/python3.10/site-packages/pluggy/callers.py", line 203, in _multicall gen.send(outcome) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse config: Config = outcome.get_result() File "/home/qa/.local/lib/python3.10/site-packages/pluggy/callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "/home/qa/.local/lib/python3.10/site-packages/pluggy/callers.py", line 187, in _multicall res = hook_impl.function(*args) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse self.parse(args) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1283, in parse self._preparse(args, addopts=addopts) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1172, in _preparse self.pluginmanager.load_setuptools_entrypoints("pytest11") File "/home/qa/.local/lib/python3.10/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints plugin = ep.load() File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load module = import_module(match.group('module')) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 992, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "/home/qa/.local/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 161, in exec_module source_stat, co = _rewrite_test(fn, self.config) File "/home/qa/.local/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 356, in _rewrite_test co = compile(tree, fn_, "exec", dont_inherit=True) TypeError: required field "lineno" missing from alias ```

Solution

python3 -m pip install --upgrade pytest

In order to use a pytest version that work with python 3.10 in the requirements.txt file it must be replaced the following line:

pytest==6.2.2

By

pytest==6.2.2 ; python_version <= "3.9"
pytest==7.1.2 ; python_version >= "3.10"

Running integration test again :red_circle:

python3 -m pytest integration/
Output ``` ImportError while loading conftest '/home/qa/wazuh-qa/tests/integration/conftest.py'. tests/integration/conftest.py:17: in import wazuh_testing.tools.configuration as conf E ModuleNotFoundError: No module named 'wazuh_testing' ```

Centos

In the instance deployed Python 3.10.4 is not set as default python.

Select python version

sudo update-alternatives --config python3

Install requirements.txt

python3 -m pip install -r requirements.txt
Output ``` Collecting configobj==5.0.6 Using cached configobj-5.0.6.tar.gz (33 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [1 lines of output] ERROR: Can not execute `setup.py` since setuptools is not available in the build environment. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. WARNING: There was an error checking the latest version of pip. ```

Test default python 3.6.8

python3 -m pip install -r requirements.txt
Output ``` Exception: Traceback (most recent call last): File "/usr/lib64/python3.6/shutil.py", line 550, in move os.rename(src, real_dst) PermissionError: [Errno 13] Permission denied: '/usr/local/bin/py.test' -> '/tmp/pip-ye9ofkiu-uninstall/usr/local/bin/py.test' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run strip_file_prefix=options.strip_file_prefix, File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 783, in install requirement.uninstall(auto_confirm=True) File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames shutil.move(old, new) File "/usr/lib64/python3.6/shutil.py", line 565, in move os.unlink(src) PermissionError: [Errno 13] Permission denied: '/usr/local/bin/py.test' ```

Solution

Using sudo python3 -m pip install -r requirements.txt the problem will be solved.

Install QA framework

python3 deps/wazuh_testing/setup.py install
Output ``` running install error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/test-easy-install-4980.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python3.6/site-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.readthedocs.io/en/latest/easy_install.html Please make the appropriate changes for your system and try again. ```

Solution

Using python3 deps/wazuh_testing/setup.py install --user the problem will be solved.

Running integration test :red_circle:

python3 -m pytest integration/
ImportError while loading conftest '/home/qa/wazuh-qa/tests/integration/conftest.py'.
integration/conftest.py:17: in <module>
    import wazuh_testing.tools.configuration as conf
E   ModuleNotFoundError: No module named 'wazuh_testing'
fedepacher commented 2 years ago

Update 2022/06/23

Windows Server 2016/2022

Install requirements.txt

python3 -m pip install -r requirements.txt
Output ``` Downloading cffi-1.14.6.tar.gz (475 kB) ---------------------------------------- 475.7/475.7 kB 4.3 MB/s eta 0:00:00 Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [20 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\qa\AppData\Local\Temp\pip-install-ufvisjha\cffi_8cba5ce532384348a5fe03ce2af70224\setup.py", line 127, in if sys.platform == 'win32' and uses_msvc(): File "C:\Users\qa\AppData\Local\Temp\pip-install-ufvisjha\cffi_8cba5ce532384348a5fe03ce2af70224\setup.py", line 105, in uses_msvc return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif') File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\distutils\command\config.py", line 225, in try_compile self._compile(body, headers, include_dirs, lang) File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\distutils\command\config.py", line 132, in _compile self.compiler.compile([src], include_dirs=include_dirs) File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\distutils\_msvccompiler.py", line 323, in compile self.initialize() File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\distutils\_msvccompiler.py", line 220, in initialize vc_env = _get_vc_env(plat_spec) File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env return _msvc14_get_vc_env(plat_spec) File "C:\Users\qa\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\msvc.py", line 270, in _msvc14_get_vc_env raise distutils.errors.DistutilsPlatformError( distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details. WARNING: There was an error checking the latest version of pip. ```