Skip to content

Commit f26c012

Browse files
committed
Fix GitHub workflow
1 parent c1c184a commit f26c012

File tree

5 files changed

+29
-32
lines changed

5 files changed

+29
-32
lines changed

.github/workflows/zeyple.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [2.7, 3.7]
16+
python-version: [3.11, 3.12]
1717
fail-fast: false
1818
steps:
1919
- name: Checkout repository
20-
uses: actions/checkout@v1
20+
uses: actions/checkout@v4
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@v5
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
@@ -28,16 +28,16 @@ jobs:
2828
sudo apt-get install debconf-utils
2929
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local only'"
3030
sudo debconf-set-selections <<< "postfix postfix/mailname string localhost"
31-
sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python-gpg libgpgme-dev swig
32-
python -m pip install --upgrade pip
33-
pip install -r requirements_gpg.txt
31+
sudo apt-get install -y mailutils ruby ruby-dev rubygems build-essential sudo gnupg python3-gpg
3432
sudo gem install --no-document fpm
35-
- name: Test
36-
run: python -m pytest tests/
33+
python -m pip install --upgrade pip setuptools wheel
34+
python -m pip install --upgrade tox
3735
- name: Build deb package
3836
run: ./fpm/create
3937
- name: End to end test using deb package
4038
run: sudo bash -ex ./tests/e2e.sh
39+
- name: Test with tox
40+
run: tox
4141
- name: Upload deb package
4242
uses: actions/upload-artifact@v1
4343
with:

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ If you want to contribute, please:
1212
You will need the following development dependencies.
1313

1414
* Packages:
15-
* Arch Linux: `pacman -S python-gpgme`
16-
* Debian/Ubuntu: `apt-get install libgpgme-dev`
17-
* Fedora: `yum install gpgme-devel python-devel python3-devel`
18-
* Python eggs: `pip install -r requirements.txt`
15+
* Arch Linux: `pacman -S python-gpgme python-tox`
16+
* Debian/Ubuntu: `apt-get install python3-gpg tox`
17+
* Fedora: `yum install python3-devel gpgme-devel tox`
1918

2019
## Testing
2120

requirements.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/test_zeyple.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
from six.moves.configparser import ConfigParser
4+
from configparser import ConfigParser
55
from textwrap import dedent
66
from unittest.mock import Mock
77
from zeyple import zeyple
8-
import gpg
8+
#import gpg
99
import os
1010
import re
1111
import shutil
@@ -22,6 +22,7 @@
2222
TEST_EXPIRED_ID = 'ED97E21F1C7F1AC6'
2323
TEST_EXPIRED_EMAIL = '[email protected]'
2424

25+
2526
class ZeypleTest(unittest.TestCase):
2627
def setUp(self):
2728
self.tmpdir = tempfile.mkdtemp()
@@ -71,18 +72,19 @@ def assertValidMimeMessage(self, cipher_message, mime_message):
7172

7273
plain_payload = cipher_message.get_payload()
7374
encrypted_envelope = plain_payload[1]
74-
assert encrypted_envelope["Content-Type"] == 'application/octet-stream; name="encrypted.asc"'
75+
assert (encrypted_envelope["Content-Type"] ==
76+
'application/octet-stream; name="encrypted.asc"')
7577

7678
encrypted_payload = encrypted_envelope.get_payload().encode('utf-8')
7779
decrypted_envelope = self.decrypt(encrypted_payload).decode('utf-8').strip()
7880

79-
boundary = re.match(r'.+boundary="([^"]+)"', decrypted_envelope, re.MULTILINE | re.DOTALL).group(1)
81+
boundary = re.match(r'.+boundary="([^"]+)"',
82+
decrypted_envelope, re.MULTILINE | re.DOTALL).group(1)
8083
# replace auto-generated boundary with one we know
8184
mime_message = mime_message.replace("BOUNDARY", boundary)
8285

8386
prefix = dedent("""\
84-
Content-Type: multipart/mixed; boundary=\"""" + \
85-
boundary + """\"
87+
Content-Type: multipart/mixed; boundary=\"""" + boundary + """\"
8688
8789
""")
8890
mime_message = prefix + mime_message
@@ -237,7 +239,7 @@ def test_process_message_with_complex_message(self):
237239
with open(filename, 'r') as test_file:
238240
contents = test_file.read()
239241

240-
self.zeyple.process_message(contents, [TEST1_EMAIL]) # should not raise
242+
self.zeyple.process_message(contents, [TEST1_EMAIL]) # should not raise
241243

242244
def test_force_encryption(self):
243245
"""Tries to encrypt without key"""

tox.ini

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ skip_missing_interpreters = True
44
skipsdist = True
55

66
[testenv]
7-
deps = -rrequirements.txt
7+
deps =
8+
mock
9+
pycodestyle
10+
pytest
11+
pytest-cov
812
setenv =
9-
PYTHONPATH = {toxinidir}
13+
PYTHONPATH = {toxinidir}:/usr/lib/python3.12/site-packages/:/usr/lib/python3/dist-packages/
14+
#list_dependencies_command = python -m pip list
1015
commands =
11-
pycodestyle --show-pep8 zeyple
12-
py.test {posargs:--cov-report=html --cov=zeyple/}
16+
python -m pytest --cov=zeyple/ --cov-report=html
17+
pycodestyle --show-pep8 --max-line-length=100

0 commit comments

Comments
 (0)