aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* python,doc: Fix typos in documentation and source code commentsIngo Klöcker2023-10-131-1/+1
| | | | | | | | -- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
* tests: Stop daemons after setting up test environmentIngo Klöcker2023-02-091-0/+1
| | | | | | | | | | * lang/python/tests/Makefile.am, lang/qt/tests/Makefile.am, tests/gpg/Makefile.am, tests/json/Makefile.am (pubring-stamp): Call `gpgconf --kill all` after importing test keys. -- This ensures that no gpg-agents or other daemons are running after "make".
* python: Don't call __del__ from __exit__ method.NIIBE Yutaka2022-08-091-0/+3
| | | | | | | | | | | * lang/python/src/core.py (Context, Data): Don't call __del__ from __exit__ method, as the object may be still in use. * lang/python/tests/t-idiomatic.py: Fix the test. -- GnuPG-bug-id: 6060 Signed-off-by: NIIBE Yutaka <[email protected]>
* python: Fix a test for newer GnuPG (>= 2.3).NIIBE Yutaka2020-11-121-1/+2
| | | | | | | | | | | * lang/python/tests/t-quick-subkey-creation.py: Specify RSA. -- Using GnuPG 2.3, a key with default (ed25519/cv25519) cannot have some combination of capabilities (e.g., "encr auth"). Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Deprecate the non-working trustlist functions.Werner Koch2020-07-152-47/+0
| | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in: Clarify that the trustlist function should not be used. * src/engine.c (_gpgme_engine_op_trustlist): Always return an error. * src/engine-backend.h (struct engine_ops): Remove trustlist member. * src/engine-gpg.c (gpg_trustlist): Remove. (struct engine_ops): Remove that member. Also in all other engines. * tests/gpg/t-trustlist.c: Remove. * lang/python/tests/t-trustlist.py: Remove. -- This never worked in reality because the required feature has been removed from GnuPG version 1.3.2 soon after introduction of this feature in gpgme - 17 years ago. It was anyway marked as experimental. We keep the API and ABI, though. GnuPG-bug-id: 4834 Signed-off-by: Werner Koch <[email protected]>
* python: Workaround for a regression in GnuPG 2.2.21Werner Koch2020-07-142-2/+16
| | | | | | | | | * lang/python/tests/support.py (is_gpg_version): New. * lang/python/tests/t-encrypt-sym.py: Add workaround. -- GnuPG-bug-id: 4991 Signed-off-by: Werner Koch <[email protected]>
* python: Fix regression in t-decrypt-verify test.Werner Koch2019-06-131-11/+11
| | | | | | | | * lang/python/tests/t-decrypt-verify.py: Comment recent changes. -- Fixes-commit: bd2d282e572b5d02669238c9e087259b85638477 GnuPG-bug-id: 4276
* python: Set a default-key into gpg.conf for the tests.Werner Koch2019-06-131-2/+1
| | | | | | | | | | | | | | | | | | | | * lang/python/tests/Makefile.am (gpg.conf): Set a default key. -- It seems we need to set a default key because at least t-sign.py does not specify the key to use and we do not want to rely on the order of keys in the keyring. Also Fixes-commit: f3ca2c9ce9fd4a03e293065f10b92589a7e642d6 gpg 2.0 is end-of-life and we don't need these extra options anymore. In fact they for the use of some gpg version and don't use the version gpgconf knows about. This also aligns the python tests to what we use for the C test suite. Signed-off-by: Werner Koch <[email protected]>
* python: stop raising BadSignatures from decrypt(verify=True)dkg/fix-T4276Daniel Kahn Gillmor2019-05-031-0/+1
| | | | | | | | | | | | | | | | | * src/core.py (decrypt): filter out signatures with errors from the returned verify_result, but avoid raising BadSignatures * tests/t-decrypt-verify.py: ensure that only a single signature is returned when evaluating cipher-3.asc, since the other signature is unknown. -- This change preserves the invariant that decrypt() only ever returns valid signatures in the verify_result, but it avoids unnecessary errors in the face of the presence of an additional bad signature. GnuPG-bug-id: 4276 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python/tests: try to decrypt and verify new test dataDaniel Kahn Gillmor2019-05-032-0/+21
| | | | | | | | | | | | | | | * lang/python/tests/t-decrypt.py: test decryption of cipher-3.asc and cipher-no-sig.asc * lang/python/tests/t-decrypt-verify.py: test decryption and verification of cipher-3.asc and cipher-no-sig.asc -- note that this introduces a failed test -- decrypt-verify.py misbehaves on cipher-3.asc by throwing a BadSignature even though GnuPG-bug-id: 4276 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python: make it easier to run a limited number of testsDaniel Kahn Gillmor2019-05-031-1/+1
| | | | | | | | | | | | | | | | * lang/python/tests/Makefile.am: prefer py_tests from the environment if present. -- I'm trying to make it nicer/quicker to hack on the testsuite for python bindings. With this change, if you're improving the python bindings test suite, you can selectively run only a few specific tests like so: lang/python$ make check py_tests='t-decrypt.py t-decrypt-verify.py' Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python: overhaul logic of Context.decrypt()Daniel Kahn Gillmor2018-12-051-1/+1
| | | | | | | | | | | | | | * lang/python/src/core.py (Context.decrypt): simplify and clarify the logic behind handling verify=False. * lang/python/tests/t-decrypt.py: ensure that we test verify=False -- The function-internal variables were pretty unclear to the reader, and the logic caused pretty nasty breakage when verify=False. GnuPG-Bug-Id: 4271 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-081-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python bindings: callback testBen McGinnes2018-10-201-2/+30
| | | | | | | * lang/python/tests/t-callbacks.py: Updated test logic to try generating a key which expires in 2099 and if that fails then fallback to an expiration in 2037 in an attempt to catch the 32-bit systems.
* doc: convert more http:// links to https://Daniel Kahn Gillmor2018-10-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: use https:// for www.gnu.orgDaniel Kahn Gillmor2018-10-1832-33/+33
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* python bindings: fixing decrypt-verifyBen McGinnes2018-09-301-1/+1
| | | | | | | | | | | | * lang/python/src/core.py: First restoring the exception to the being just that. * The means to manipulate the error output is temporarily in commented out code, but ought to be added to a proper test later. * In the mean time the original test, with a very slight change, works again. Tested-by: Ben McGinnes <[email protected]> Signed-off-by: Ben McGinnes <[email protected]>
* tests: python bindingsBen McGinnes2018-09-271-1/+1
| | | | | | * Fixed the final assertion to look for what will actually be reported in that case instead of something else (i.e. it looks for an IMPORT_ERROR status code).
* python: Fix a couple of syntax errors.Werner Koch2018-09-204-84/+92
| | | | | | | | | | * lang/python/tests/t-keylist-from-data.py: Add missing line continuation. * lang/python/tests/t-keylist.py: Ditto. * lang/python/tests/t-quick-key-creation.py: Ditto. * lang/python/tests/t-quick-subkey-creation.py: Ditto. Signed-off-by: Werner Koch <[email protected]>
* python: Fix regression in the test suite.Werner Koch2018-09-201-1/+1
| | | | | | | | * lang/python/tests/Makefile.am (GNUPGHOME): Remove stray backslash. -- Fixes-commit: d09d19fa9fe1e81dd819b32208b4bd09f83e3918 Signed-off-by: Werner Koch <[email protected]>
* tests: Don't try using keys from a scmartcard.Werner Koch2018-09-201-0/+4
| | | | | | | * tests/gpg/Makefile.am: Disable scdaemon * lang/python/tests/Makefile.am: Ditto. Signed-off-by: Werner Koch <[email protected]>
* Python bindings tests: Near PEP8 complianceBen McGinnes2018-08-1831-500/+773
| | | | * PEP8 compliance for the vast majoeity of the tests.
* Make GNUPGHOME for tests overridableAndre Heinecke2018-08-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/tests/Makefile.am, lang/qt/tests/Makefile.am, tests/Makefile.am, tests/gpg/Makefile.am, tests/gpgsm/Makefile.am, tests/opassuan/Makefile.am (GNUPGHOME): Make variable explict. -- If the build directory has too long path, gpgme could fail. This is similar to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206 In order to fix that, this patch extracts the GNUPGHOME variable to be presented directly in the Makefile and thus overridable by command line option. A build system can then create a symlink to the GNUPGHOME directory in /tmp and use that symlink as the GNUPGHOME directory thus making the path very short. GnuPG-Bug-Id: T4091 Patch provided by vlmarek
* python bindings: core key importBen McGinnes2018-06-161-5/+9
| | | | | | | | | | | | * The foundation of a pythonic key import function authored by Jacob Adams. * A unit testing script for the same function originally authored by Tobias Mueller * Added DCO reference for Jacob Adams to the GPGME AUTHORS file. * Additional details regarding this patch are available here: https://dev.gnupg.org/T4001 Signed-off-by: Ben McGinnes <[email protected]>
* python: key expiration datetime stamp testsBen McGinnes2018-05-051-1/+1
| | | | | | | | | * Changed the expiration date for the generated test key to NYE this century, rather than the NYE this millennium as originally suggested in job #3815. * This covers the lifetimes of current users (except, maybe, some very healthy millennials) as well as the 32-bit clock end date in 2038; without falling foul of OpenPGP's 2106 expiration.
* tests: Makefile portability.NIIBE Yutaka2018-02-151-6/+4
| | | | | | | | | | | | * tests/gpg/Makefile.am: Don't use "export" directive. * tests/gpgsm/Makefile.am: Ditto. * lang/qt/tests/Makefile.am: Ditto. * lang/python/tests/Makefile.am: Ditto. -- GnuPG-bug-id: 3056 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: More Makefile fix.NIIBE Yutaka2018-02-151-6/+5
| | | | | | * lang/python/tests/Makefile.am: Avoid target with '/'. Signed-off-by: NIIBE Yutaka <[email protected]>
* python: Default whence argument for Data() to SEEK_SET.Tobias Mueller2017-12-041-0/+6
| | | | | | | | | | | | | | * lang/python/gpgme.i: copied signature from gpgme.h and defaulted the value to SEEK_SET. * lang/python/tests/t-data.py: Added a test for no second argument -- Having to import the os package when wanting to read a Data object is a slight annoyance. With SWIG, we can define default parameters. This change defaults the whence argument to SEEK_SET which is how StringIO and BytesIO behave. Signed-off-by: Tobias Mueller <[email protected]>
* tests: Make portability fix.NIIBE Yutaka2017-11-211-4/+4
| | | | | | | | | | | | | | * lang/python/tests/Makefile.am: Distinguish target and path. * tests/gpg/Makefile.am: Ditto. * tests/gpgsm/Makefile.am: Ditto. -- GNU Make is powerful enough to match path to target (and vice versa), but BSD make is not. GnuPG-bug-id: 3056 Signed-off-by: NIIBE Yutaka <[email protected]>
* python: Support parallel build in testsAlon Bar-Lev2017-08-211-1/+1
| | | | | | | * lang/python/tests/Makefile.am: Depend xcheck with all which was lost due to the check hack. Signed-off-by: Alon Bar-Lev <[email protected]>
* python: Improve keylist test.Justus Winter2017-08-211-0/+3
| | | | | | * lang/python/tests/t-keylist.py: Check a keylist matching no keys. Signed-off-by: Justus Winter <[email protected]>
* python: Fix test environment creation.Justus Winter2017-05-101-1/+0
| | | | | | | * lang/python/tests/Makefile.am (pubring-stamp): Do not depend on the configuration files, this can trigger superfluous rebuilds. Signed-off-by: Justus Winter <[email protected]>
* tests: Make sure to kill all previously running daemons.Justus Winter2017-05-101-0/+1
| | | | | | | | | | | | | | | | * lang/python/tests/Makefile.am: Kill all previously running daemons before creating the private key store. * lang/qt/tests/Makefile.am: Likewise. * tests/gpg/Makefile.am: Likewise. * tests/gpgsm/Makefile.am: Likewise. -- Now that the daemons sockets are no longer created in the GNUPGHOME, we cannot rely on cleaning the build directory to make sure they are shut down. Therefore, we explicitly kill any running daemons when creating the test environment. Signed-off-by: Justus Winter <[email protected]>
* tests: Harmonize test suites.Justus Winter2017-05-101-1/+4
| | | | | | | | | | | | * lang/python/tests/Makefile.am: Create test environment as part of 'make all'. * tests/gpg/Makefile.am: Make sure the private keystore is created first. * tests/gpgsm/Makefile.am: Create test environment as part of 'make all'. Make sure the private keystore is created first. Signed-off-by: Justus Winter <[email protected]>
* python: Skip TOFU test if not supported by GnuPG.Justus Winter2017-04-112-0/+11
| | | | | | | | * lang/python/tests/support.py (have_tofu_support): New function. * lang/python/tests/t-quick-key-manipulation.py: Skip TOFU test if not supported by GnuPG. Signed-off-by: Justus Winter <[email protected]>
* python: fix run-tests missing python_libdirAlon Bar-Lev2017-04-111-1/+3
| | | | | | | * lang/python/tests/run-tests.py: Set python_libdir if --python-libdir is set. Signed-off-by: Alon Bar-Lev <[email protected]>
* python: Support alternatate libdir for testsAlon Bar-Lev2017-04-101-10/+15
| | | | | | | | | | | | * lang/python/tests/run-tests.py: Add --python-libdir optional parameter. -- This will make the python tests usable for downstream that build python module outside of autotools build system. Signed-off-by: Alon Bar-Lev <[email protected]>
* python: Remove usage of PYTHON_VERSIONSAlon Bar-Lev2017-04-101-2/+2
| | | | | | | | | | | | | | | | | | | | | * configure.ac: Remove PYTHON_VERSIONS subst. * lang/python/Makefile.am: Use basename of python as builddir prefix. * lang/python/tests/run-tests.py: Likewise. -- Two variables needs be at sync PYTHONS and PYTHON_VERSIONS, these may go out of sync in some cases, for example in Gentoo where default python is 3.4 we get: PYTHON='/usr/bin/python2' PYTHONS='/usr/bin/python /usr/bin/python2' PYTHON_VERSIONS='2.7 3.4' We can use the basename of the python interpreter to achieve similar effect without having to sync indexes between these two variables. Signed-off-by: Alon Bar-Lev <[email protected]>
* python: Generate files into build directoryAlon Bar-Lev2017-04-051-1/+0
| | | | | | | | | | | | | | | | * lang/python/setup.py.in: Generate files within BuildExtFirstHack adjust build flags at this point instead of global. * lang/python/Makefile.am: Remove logic of separate source directory per python version in favor of build directory. * lang/python/tests/run-tests.py: Adjust build directory location. -- Generate files into build directory, leaving the source directory clean. Use the same source directory for multiple python version build. Result of 'prepare' target is a standard distutil layout that can be used easily by downstream to build all python targets in-place. Signed-off-by: Alon Bar-Lev <[email protected]>
* python: Don't treat skipped tests as errorAndre Heinecke2017-03-301-1/+1
| | | | | * lang/python/tests/run-tests.py (failed): Don't count skipped tests for the return code.
* python: Fix skipping tests if running with GnuPG < 2.1.12.Justus Winter2017-03-3014-8/+17
| | | | | | | | | | | | | | | | | | | | | | * final.py: Import 'support.py' for the side-effect of checking the GnuPG version. * t-data.py: Likewise. * t-protocol-assuan.py: Likewise. * t-wrapper.py: Likewise. * t-callbacks.py: Avoid warning about 'support' being unused. * t-edit.py: Likewise. * t-encrypt-sym.py: Likewise. * t-file-name.py: Likewise. * t-idiomatic.py: Likewise. * t-sig-notation.py: Likewise. * t-trustlist.py: Likewise. * t-verify.py: Likewise. * t-wait.py: Likewise. * t-keylist-from-data.py: Trim unused imports. GnuPG-bug-id: 3008 Fixes-commit: 348da58fe0c3656e6177c98fef6b4c4331326c8e Signed-off-by: Justus Winter <[email protected]>
* python: Skip tests if running with GnuPG < 2.1.12.Justus Winter2017-03-271-1/+6
| | | | | | | | * lang/python/tests/support.py (assert_gpg_version): Fix error message. Skip all tests when we use GnuPG older than 2.1.12. GnuPG-bug-id: 3008 Signed-off-by: Justus Winter <[email protected]>
* python: Wrap 'gpgme_op_keylist_from_data_start'.Justus Winter2017-03-213-1/+221
| | | | | | | | | | | | | | * NEWS: Update. * lang/python/gpg/core.py (Context.keylist): New keyword argument 'source'. If given, list keys from 'source'. * lang/python/gpgme.i: Wrap the argument to 'gpgme_op_keylist_from_data_start'. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/support.py (EphemeralContext): Do not throw an error if no agent has been started in the context. * lang/python/tests/t-keylist-from-data.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Fix version check.Justus Winter2017-03-201-1/+3
| | | | | | | | * lang/python/tests/support.py (assert_gpg_version): Cope with non-released versions. Fixes-commit: e1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6 Signed-off-by: Justus Winter <[email protected]>
* tests: Use 'gpg-agent --allow-loopback-pinentry' if applicable.Justus Winter2017-03-201-1/+0
| | | | | | | | | | | * lang/python/tests/Makefile.am (gpg-agent.conf): Do not hard-code the option. This breaks gpg-agent from GnuPG 2.0. * tests/start-stop-agent: Rather, check if the option is supported and add it to the configuration if it is. GnuPG-bug-id: 3008 Fixes-commit: bbf19124bbec9eb6298cef2914baae7ac74382fe Signed-off-by: Justus Winter <[email protected]>
* python: Skip tests if GnuPG is too old.Justus Winter2017-03-207-0/+16
| | | | | | | | | | | | | | * lang/python/tests/support.py (assert_gpg_version): New function. * lang/python/tests/t-callbacks.py: Use the new function to skip the test if GnuPG is too old. * lang/python/tests/t-edit.py: Likewise. * lang/python/tests/t-encrypt-sym.py: Likewise. * lang/python/tests/t-quick-key-creation.py: Likewise. * lang/python/tests/t-quick-key-manipulation.py: Likewise. * lang/python/tests/t-quick-key-signing.py: Likewise. GnuPG-bug-id: 3008 Signed-off-by: Justus Winter <[email protected]>
* python: Remove superfluous initialization.Justus Winter2017-03-2021-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/tests/support.py (init_gpgme): Remove. This is an remnant from the c tests. Nowadays, the Python bindings initialize GPGME automagically. * lang/python/tests/initial.py: Remove call to 'support.init_gpgme'. * lang/python/tests/t-callbacks.py: Likewise. * lang/python/tests/t-decrypt-verify.py: Likewise. * lang/python/tests/t-decrypt.py: Likewise. * lang/python/tests/t-edit.py: Likewise. * lang/python/tests/t-encrypt-large.py: Likewise. * lang/python/tests/t-encrypt-sign.py: Likewise. * lang/python/tests/t-encrypt-sym.py: Likewise. * lang/python/tests/t-encrypt.py: Likewise. * lang/python/tests/t-export.py: Likewise. * lang/python/tests/t-file-name.py: Likewise. * lang/python/tests/t-idiomatic.py: Likewise. * lang/python/tests/t-import.py: Likewise. * lang/python/tests/t-keylist.py: Likewise. * lang/python/tests/t-sig-notation.py: Likewise. * lang/python/tests/t-sign.py: Likewise. * lang/python/tests/t-signers.py: Likewise. * lang/python/tests/t-trustlist.py: Likewise. * lang/python/tests/t-verify.py: Likewise. * lang/python/tests/t-wait.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Make error message more helpful.Justus Winter2017-03-141-6/+11
| | | | | | | * lang/python/tests/run-tests.py: Make the error message shown when we cannot locate the python module in the build tree more helpful. Signed-off-by: Justus Winter <[email protected]>
* python: Make tests more robust.Justus Winter2017-03-141-11/+10
| | | | | | | | | * lang/python/tests/support.py (TemporaryDirectory): Always use our own version even if 'tempfile.TemporaryDirectory' is provided, because we need to use 'shutil.rmtree(..., ignore_errors=True)' to avoid it tripping over gpg-agent deleting its own sockets. Signed-off-by: Justus Winter <[email protected]>
* python: Print path of the Python module used during tests.Justus Winter2017-03-021-0/+3
| | | | | | | | * lang/python/tests/initial.py: Print path of the Python module used during tests. Useful to detect if by any mistake the wrong module is picked up. Signed-off-by: Justus Winter <[email protected]>