liip / liip/requests_gpgauthlib

Tests fail while setting up GPG

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

running `python -m pytest` leads to:
```
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
rootdir: /build/python-requests-gpgauthlib/src/requests_gpgauthlib-0.1.2
plugins: requests-mock-1.8.0
collected 29 items

tests/unit/test_gpgauthsession.py .EEEEEEEEEEEEEEEEE [ 62%]
tests/unit/test_utils.py ......FFFFF [100%]

==================================== ERRORS ====================================
_ ERROR at setup of TestGPGAuthSession.test_gpgauth_version_is_supported_not_in_absence_of_headers _

self =

def setup_class(self):
# Setup a server
self.server_gnupg_home = get_temporary_workdir()
> self.server_gpg = create_gpg(self.server_gnupg_home.name)

tests/unit/test_gpgauthsession.py:49:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
requests_gpgauthlib/utils.py:43: in create_gpg
gpg = GPG(gnupghome=os.path.join(workdir, '.gnupg'))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = , gpgbinary = 'gpg'
gnupghome = '/tmp/requests_gpgauthlib-vx9ib7ms/.gnupg', verbose = False
use_agent = False, keyring = None, options = None, secret_keyring = None

def __init__(self, gpgbinary='gpg', gnupghome=None, verbose=False,
use_agent=False, keyring=None, options=None,
secret_keyring=None):
"""Initialize a GPG process wrapper. Options are:

gpgbinary -- full pathname for GPG binary.

gnupghome -- full pathname to where we can find the public and
private keyrings. Default is whatever gpg defaults to.
keyring -- name of alternative keyring file to use, or list of such
keyrings. If specified, the default keyring is not used.
options =-- a list of additional options to pass to the GPG binary.
secret_keyring -- name of alternative secret keyring file to use, or
list of such keyrings.
"""
self.gpgbinary = gpgbinary
self.gnupghome = gnupghome
# issue 112: fail if the specified value isn't a directory
if gnupghome and not os.path.isdir(gnupghome):
> raise ValueError('gnupghome should be a directory (it isn\'t): %s' % gnupghome)
E ValueError: gnupghome should be a directory (it isn't): /tmp/requests_gpgauthlib-vx9ib7ms/.gnupg

/usr/lib/python3.8/site-packages/gnupg.py:827: ValueError
_ ERROR at setup of TestGPGAuthSession.test_gpgauth_version_is_supported_not_for_wrong_versions _

self =

def setup_class(self):
# Setup a server
self.server_gnupg_home = get_temporary_workdir()
> self.server_gpg = create_gpg(self.server_gnupg_home.name)
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with create_gpg in requests_gpgauthlib/utils.py and the setup_class path in tests/unit/test_gpgauthsession.py, then run python -m pytest to reproduce the failure. Check how the temporary GPG home is prepared before initialization; done means GPG setup completes and the existing test suite passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.