vext01 / passout

Simple password manager built on GnuPG.
4 stars 1 forks source link

Python3 test failures #16

Open vext01 opened 9 years ago

vext01 commented 9 years ago
$ py.test-3                       
============================= test session starts ==============================
platform openbsd5 -- Python 3.4.3 -- py-1.4.23 -- pytest-2.6.1
collected 20 items 

tests/test_cli.py .....F..
tests/test_lib.py ....F.......

=================================== FAILURES ===================================
______________________________ TestCLI.test_clip _______________________________

self = <test_cli.TestCLI object at 0x72dbec165f8>
rand_pwname = 'a26f53047b3411e5b094e5dc0d194d6c'
rand_pw = 'a26f57787b3411e5b094e5dc0d194d6c'

    @pytest.mark.skipif(os.environ["DISPLAY"] is None, reason="No X11")
    def test_clip(self, rand_pwname, rand_pw):
        # XXX skip if xclip not found

        child1 = self.run_passout("add", rand_pwname)
        child1.expect_exact("Password: ")
        child1.sendline(rand_pw)
        child1.expect_exact(pexpect.EOF)

        child2 = self.run_passout("clip", rand_pwname)
        child2.expect(pexpect.EOF)

        # Testing all clipboards
        import passout
        for clip in passout.XCLIP_CLIPBOARDS:
            data = support.get_clipboard_text(clip)
>           assert data == rand_pw
E           assert '' == 'a26f57787b3411e5b094e5dc0d194d6c'
E             + a26f57787b3411e5b094e5dc0d194d6c

tests/test_cli.py:83: AssertionError
______________________________ TestLib.test_clip _______________________________

self = <test_lib.TestLib object at 0x72d34f41e10>
cfg = {'gpg': 'gpg2', 'id': 'test@localhost'}
rand_pwname = 'a7990abe7b3411e5b094e5dc0d194d6c'
rand_pw = 'a799141e7b3411e5b094e5dc0d194d6c'

    @pytest.mark.skipif(os.environ["DISPLAY"] is None, reason="No X11")
    def test_clip(self, cfg, rand_pwname, rand_pw):
        # XXX skip if xclip not found

        passout.add_password(cfg, rand_pwname, rand_pw)
>       passout.load_clipboard(cfg, rand_pwname, testing=True)

tests/test_lib.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
passout/__init__.py:180: in load_clipboard
    (out, err) = pipe.communicate(passwd)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <subprocess.Popen object at 0x72d34f41438>
input = 'a799141e7b3411e5b094e5dc0d194d6c', timeout = None

    def communicate(self, input=None, timeout=None):
        """Interact with process: Send data to stdin.  Read data from
            stdout and stderr, until end-of-file is reached.  Wait for
            process to terminate.  The optional input argument should be
            bytes to be sent to the child process, or None, if no data
            should be sent to the child.

            communicate() returns a tuple (stdout, stderr)."""

        if self._communication_started and input:
            raise ValueError("Cannot send input after starting communication")

        # Optimization: If we are not worried about timeouts, we haven't
        # started communicating, and we have one or zero pipes, using select()
        # or threads is unnecessary.
        if (timeout is None and not self._communication_started and
            [self.stdin, self.stdout, self.stderr].count(None) >= 2):
            stdout = None
            stderr = None
            if self.stdin:
                if input:
                    try:
>                       self.stdin.write(input)
E                       TypeError: 'str' does not support the buffer interface

/usr/local/lib/python3.4/subprocess.py:941: TypeError
----------------------------- Captured stderr call -----------------------------
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
===================== 2 failed, 18 passed in 25.61 seconds =====================