aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-02-15tests: Makefile portability.NIIBE Yutaka1-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]>
2018-02-15build: More Makefile fix.NIIBE Yutaka1-6/+5
* lang/python/tests/Makefile.am: Avoid target with '/'. Signed-off-by: NIIBE Yutaka <[email protected]>
2017-12-04python: Default whence argument for Data() to SEEK_SET.Tobias Mueller1-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]>
2017-11-21tests: Make portability fix.NIIBE Yutaka1-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]>
2017-08-21python: Support parallel build in testsAlon Bar-Lev1-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]>
2017-08-21python: Improve keylist test.Justus Winter1-0/+3
* lang/python/tests/t-keylist.py: Check a keylist matching no keys. Signed-off-by: Justus Winter <[email protected]>
2017-05-10python: Fix test environment creation.Justus Winter1-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]>
2017-05-10tests: Make sure to kill all previously running daemons.Justus Winter1-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]>
2017-05-10tests: Harmonize test suites.Justus Winter1-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]>
2017-04-11python: Skip TOFU test if not supported by GnuPG.Justus Winter2-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]>
2017-04-11python: fix run-tests missing python_libdirAlon Bar-Lev1-1/+3
* lang/python/tests/run-tests.py: Set python_libdir if --python-libdir is set. Signed-off-by: Alon Bar-Lev <[email protected]>
2017-04-10python: Support alternatate libdir for testsAlon Bar-Lev1-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]>
2017-04-10python: Remove usage of PYTHON_VERSIONSAlon Bar-Lev1-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]>
2017-04-05python: Generate files into build directoryAlon Bar-Lev1-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]>
2017-03-30python: Don't treat skipped tests as errorAndre Heinecke1-1/+1
* lang/python/tests/run-tests.py (failed): Don't count skipped tests for the return code.
2017-03-30python: Fix skipping tests if running with GnuPG < 2.1.12.Justus Winter14-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]>
2017-03-27python: Skip tests if running with GnuPG < 2.1.12.Justus Winter1-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]>
2017-03-21python: Wrap 'gpgme_op_keylist_from_data_start'.Justus Winter3-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]>
2017-03-20python: Fix version check.Justus Winter1-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]>
2017-03-20tests: Use 'gpg-agent --allow-loopback-pinentry' if applicable.Justus Winter1-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]>
2017-03-20python: Skip tests if GnuPG is too old.Justus Winter7-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]>
2017-03-20python: Remove superfluous initialization.Justus Winter21-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]>
2017-03-14python: Make error message more helpful.Justus Winter1-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]>
2017-03-14python: Make tests more robust.Justus Winter1-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]>
2017-03-02python: Print path of the Python module used during tests.Justus Winter1-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]>
2017-02-20python: Fix test.Justus Winter1-1/+2
* lang/python/tests/t-quick-key-manipulation.py: Modify the configuration file in the ephemeral home directory, not the one used by all the tests. Fixes-commit: 15fbac9e72a4d1bff9a3b9e9822f9175b09fbcd5 Signed-off-by: Justus Winter <[email protected]>
2017-02-17python: Support manipulating the TOFU policy.Justus Winter1-0/+31
* NEWS: Update. * doc/gpgme.texi: Fix typos. * lang/python/gpg/constants/__init__.py: Import new files. * lang/python/gpg/constants/tofu/__init__.py: New file. * lang/python/gpg/constants/tofu/policy.py: New file. * lang/python/gpg/core.py (Context.key_tofu_policy): New function. * lang/python/gpgme.i: Nice reprs for gpgme_tofu_info_t. * lang/python/setup.py.in: Install new package. * lang/python/tests/t-quick-key-manipulation.py: Extend test. Signed-off-by: Justus Winter <[email protected]>
2017-02-17python: Support quick key signing.Justus Winter2-1/+122
* NEWS: Update. * doc/gpgme.texi (gpgme_op_keysign): Fix the description of the 'expire' argument. * lang/python/gpg/constants/__init__.py: Import new file. * lang/python/gpg/constants/keysign.py: New file. * lang/python/gpg/core.py (Context.key_sign): New function. * lang/python/tests/Makefile.am (py_tests): Add new test. * lang/python/tests/t-quick-key-signing.py: New test. Signed-off-by: Justus Winter <[email protected]>
2017-02-17python: Fix teardown of ephemeral contexts.Justus Winter4-260/+250
* lang/python/tests/support.py (EphemeralContext): New function. * lang/python/tests/t-quick-key-creation.py: Use the new function to manage ephemeral contexts. * lang/python/tests/t-quick-key-manipulation.py: Likewise. * lang/python/tests/t-quick-subkey-creation.py: Likewise. -- Previously, there was a problem with cleaning up ephemeral home directories. shutil.rmtree deleted the agents main socket, gpg-agent detected that, and deleted the other sockets as well, racing shutil.rmtree which did not cope will with that. Fix this by asking the agent nicely to shut down. Signed-off-by: Justus Winter <[email protected]>
2017-02-17python: Fix using strings as commands in the assuan protocol.Justus Winter1-3/+6
* lang/python/gpg/core.py (Context.assuan_transact): Fix testing whether the command is a string on Python2. * lang/python/tests/t-protocol-assuan.py: Improve the test to detect this problem. Signed-off-by: Justus Winter <[email protected]>
2017-02-16python: Support adding and revoking UIDs.Justus Winter2-1/+105
* NEWS: Update. * lang/python/gpg/core.py (Context.key_add_uid): New function. (Context.key_revoke_uid): Likewise. * lang/python/tests/Makefile.am (XTESTS): Add new test. * lang/python/tests/t-quick-key-manipulation.py: New file. Signed-off-by: Justus Winter <[email protected]>
2017-02-16python: Support quick subkey creation.Justus Winter2-1/+123
* NEWS: Update. * lang/python/gpg/core.py (Context.create_subkey): New function. * lang/python/tests/Makefile.am (XTESTS): Add new test. * lang/python/tests/t-quick-subkey-creation.py: New file. Signed-off-by: Justus Winter <[email protected]>
2017-02-16python: Support quick key creation.Justus Winter3-1/+168
* NEWS: Update. * lang/python/gpg/constants/__init__.py: Import new file. * lang/python/gpg/constants/create.py: New file. * lang/python/gpg/core.py (Context.create_key): New function. * lang/python/tests/Makefile.am (XTESTS): Add new test. * lang/python/tests/support.py (TemporaryDirectory): New class. * lang/python/tests/t-quick-key-creation.py: New file. Signed-off-by: Justus Winter <[email protected]>
2017-02-13python: Use one copy of the source tree per Python version.Justus Winter1-1/+3
* lang/python/Makefile.am (copystamp): Create one copy per Python version. (all-local): Adapt. (clean-local): Likewise. (install-exec-local): Likewise. * lang/python/tests/run-tests.py: Likewise. -- Currently, we use one copy of the Python module's source to build for all Python versions. This is problematic, because SWIG writes a wrapper file into the source tree. Currently, this file works with both Python 2 and 3, but this is purely by chance. Improve the situation by creating one copy per Python version so that SWIG can write version-specific code into each copy. Signed-off-by: Justus Winter <[email protected]>
2017-01-26python: Ensure quick-random is used if gpg is gpg2Andre Heinecke1-0/+2
* lang/python/tests/Makefile.am (gpg.conf): Configure agent-program accordingly.
2017-01-25python: default op_keylist_start parameters.Tobias Mueller1-0/+12
* lang/python/gpgme.i: Added gpgme_op_keylist_start with defaults * lang/python/tests/t-keylist.py: Added tests for default parameters -- To increase the ease of use, op_keylist_start parameters default to sensible values. The empty string matches all keys. We assume that the user wants to retrieve public keys most of the time, so we default to public keys rather than secret keys. Signed-off-by: Tobias Mueller <[email protected]>
2017-01-03python: Improve compatibility with Scheme tests.Justus Winter1-0/+2
* lang/python/tests/run-tests.py: Add stub --parallel option. Signed-off-by: Justus Winter <[email protected]>
2017-01-03python: Add a switch '--quiet' to the test runner.Justus Winter1-5/+12
* lang/python/tests/run-tests.py: Add and honor a switch '--quiet'. This way we can use this script to run Python tests one by one without the noise, and the script will setup the necessary environment for us. Signed-off-by: Justus Winter <[email protected]>
2016-12-05python: Try to be more helpful when given a string to encrypt().Tobias Mueller1-0/+15
* lang/python/helpers.c (_gpg_obj2gpgme_data_t): Extended error message. * lang/python/tests/t-encrypt.py: Test for "encode" in error message. -- The motivation is to help the user when encrypting fails. I claim that it is not obvious to not being able to encrypt a string directly. To nudge the user into encoding it to bytes, the error message is a bit extended. Signed-off-by: Tobias Mueller <[email protected]>
2016-12-01python: Check "buffer" when writing to sys.stdout for python2 compat.Tobias Mueller1-1/+5
* lang/python/tests/support.py (print_data): Add check for buffer. -- When running with something like make -C lang/python check verbose=2 the test would fail under python2, because the file objects do not have a buffer property. Signed-off-by: Tobias Mueller <[email protected]>
2016-11-25python: Fix removing the TOFU database.Justus Winter1-1/+1
* lang/python/Makefile.am (CLEANFILES): Move 'tofu.db'... * lang/python/tests/Makefile.am (CLEANFILES): ... here. Fixes-commit: 9b22f82afc5518961e4bea1fc516b79800e379a2 Signed-off-by: Justus Winter <[email protected]>
2016-11-11tests,python: Atomic directory creationAlon Bar-Lev1-1/+1
* lang/python/tests/Makefile.am: Use MIDIR_P. * tests/gpg/Makefile.am: Ditto. * tests/gpgsm/Makefile.am: Ditto. -- Solves race in parallel build when mkdir fails if directory exists. Signed-off-by: Alon Bar-Lev <[email protected]> - Tweaked the ChangeLog Signed-off-by: Werner Koch <[email protected]>
2016-10-31python: Use vanity modules for constants in tests and examples.Justus Winter21-74/+74
* lang/python/gpg/constants/sig/notation.py: New file. * lang/python/gpg/constants/sig/__init__.py: Import new module. * lang/python/examples/assuan.py: Use more specific module for constants, e.g. 'protocol.ASSUAN' instead of 'PROTOCOL_ASSUAN'. * lang/python/examples/testCMSgetkey.py: Likewise. * lang/python/tests/initial.py: Likewise. * 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-protocol-assuan.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]>
2016-10-31python: Import the topmost module in tests and examples.Justus Winter21-217/+208
* examples/verifydetails.py: Only import the topmost module 'gpg' and update the code accordingly. * tests/support.py: Likewise. * tests/t-callbacks.py: Likewise. * tests/t-data.py: Likewise. * tests/t-decrypt-verify.py: Likewise. * tests/t-decrypt.py: Likewise. * tests/t-edit.py: Likewise. * tests/t-encrypt-large.py: Likewise. * tests/t-encrypt-sign.py: Likewise. * tests/t-encrypt-sym.py: Likewise. * tests/t-encrypt.py: Likewise. * tests/t-export.py: Likewise. * tests/t-file-name.py: Likewise. * tests/t-import.py: Likewise. * tests/t-keylist.py: Likewise. * tests/t-sig-notation.py: Likewise. * tests/t-sign.py: Likewise. * tests/t-signers.py: Likewise. * tests/t-trustlist.py: Likewise. * tests/t-verify.py: Likewise. * tests/t-wait.py: Likewise. * tests/t-wrapper.py: Likewise. Signed-off-by: Justus Winter <[email protected]>
2016-10-31python: Rename Python module from PyME to gpg.Daniel Kahn Gillmor24-63/+63
This follows weeks of discussion on the gnupg-devel mailing list. Hopefully it will make it easier for people using Python to use GnuPG in the future. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2016-10-13python: Make 'get_key' more idiomatic.Justus Winter2-0/+24
* lang/python/pyme/core.py (Context.get_key): Raise errors.KeyNotFound if the key is not found. This error is both a KeyError for idiomatic error handling as well as a GPGMEError so we don't break existing code. * lang/python/pyme/errors.py (KeyNotFound): New class. * lang/python/tests/support.py (no_such_key): New variable. * lang/python/tests/t-keylist.py: Test the new behavior. Signed-off-by: Justus Winter <[email protected]>
2016-09-27tests: Fix blunder.Justus Winter1-1/+1
-- Fixes-commit: a423603f Signed-off-by: Justus Winter <[email protected]>
2016-09-27tests: Fix check for gpg versions not reporting the critical flag.Justus Winter1-0/+1
* lang/python/tests/t-sig-notation.py: Also blacklist 2.0.x. * tests/gpg/t-sig-notation.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
2016-09-20tests: Make "make -j distcheck" work in Python.Werner Koch1-10/+8
* lang/python/Makefile.am (SUBDIRS): Make current dir fist. * lang/python/tests/Makefile.am (xcheck): Depend on pubring-stamp. (CLEANFILES): Remove private-keys-v1.d/gpg-sample.stamp. (check-local): Remove. (initial.py): Remove dependency. (./pubring-stamp): Depend on conf files and the private-keys-v1.d/gpg-sample.stamp file. Also replace use of basename. -- This addresses the problem that two rules might run the private keys copy rule and due to the files being chmod -w during make discheck the second process running that rule's cp would get a permission error. Signed-off-by: Werner Koch <[email protected]>
2016-09-20tests: Use --batch for gpg import.Werner Koch1-3/+3
* lang/python/tests/Makefile.am (./pubring-stamp): Use --batch with GPG to avoid Pinentries during import when using GnuPG >= 2.1. Replace touch by echo. * tests/gpg/Makefile.am (./pubring-stamp): Ditto. Signed-off-by: Werner Koch <[email protected]>