I've made it so that the tests will pass with 56 specific format=flowed
issues in mind. We have the option of:
- Be strict and let foal fail forever
- Be flexible and have foal and pony differ in these specific cases
- Create a separate set of tests for both
I am leaning towards option 2, which is how it is right now. Option 1
means we can't use the tests for foal, and option 3 would mean we risk
not noticing when the two diverge.
For the places where the tests diverge (and need alternates), I've put a
top comment in each YAML specifying who/why. I think this is currently
the best compromise.
On 02/06/2021 19.27, [email protected] wrote:
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git
The following commit(s) were added to refs/heads/master by this push:
new 5793bdc Allow other versions to specifically make use of 'alternate'
5793bdc is described below
commit 5793bdc5d3c3af9fb6d1ce0378bfd8c319a17b88
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Jun 2 19:27:40 2021 +0200
Allow other versions to specifically make use of 'alternate'
Foal needs to supply an alternate in some places due to format=flowed
changes. This probably warrants a discussion on the mailing list.
---
tests/test-generators.py | 2 +-
tests/test-parsing.py | 5 ++++-
yaml/generate-httpd-users-200606-part.yaml | 2 ++
yaml/gens-asterix-dev-201709-mailarchivesao.yaml | 1 +
yaml/pars-asterix-dev-201709-mailarchivesao.yaml | 2 ++
yaml/parsing-httpd-users-200606-part.yaml | 2 ++
6 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/tests/test-generators.py b/tests/test-generators.py
index d730b3d..52b03d1 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -148,7 +148,7 @@ def run_tests(args):
expected = test['generated']
alternate = expected
- if archie.version == '10':
+ if archie.version == '10' or archie.version ==
_env.get('ALT_VERSION'):
alternate = test.get('alternate') # alternate value
for v0.10
actual = json['mid']
if actual != expected and actual != alternate:
diff --git a/tests/test-parsing.py b/tests/test-parsing.py
index fa55c86..f0ede42 100755
--- a/tests/test-parsing.py
+++ b/tests/test-parsing.py
@@ -81,6 +81,9 @@ def run_tests(args):
test_args = collections.namedtuple('testargs', ['parse_html'])(parse_html)
archie = interfacer.Archiver(archiver, test_args)
+ _env = {}
+ if 'args' in yml and 'env' in yml['args']:
+ _env = yml['args']['env']
mboxfiles = []
@@ -114,7 +117,7 @@ def run_tests(args):
body_sha3_256 =
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()
expected = test['body_sha3_256']
alternate = expected
- if archie.version == '10':
+ if archie.version == '10' or archie.version ==
_env.get('ALT_VERSION'):
alternate = test.get('alternate') # alternate value for
v0.10
if body_sha3_256 != expected and body_sha3_256 != alternate:
errors += 1
diff --git a/yaml/generate-httpd-users-200606-part.yaml
b/yaml/generate-httpd-users-200606-part.yaml
index a3c4408..3b7055a 100644
--- a/yaml/generate-httpd-users-200606-part.yaml
+++ b/yaml/generate-httpd-users-200606-part.yaml
@@ -3,6 +3,8 @@
args:
cmd: tests/test-generators.py --generate
generate-httpd-users-200606-part.yaml --mbox corpus/httpd-users-200606-part.mbox
--rootdir ../ponymail/
+ env:
+ ALT_VERSION: foal
generators:
corpus/httpd-users-200606-part.mbox:
cluster:
diff --git a/yaml/gens-asterix-dev-201709-mailarchivesao.yaml
b/yaml/gens-asterix-dev-201709-mailarchivesao.yaml
index d97437f..67fe530 100644
--- a/yaml/gens-asterix-dev-201709-mailarchivesao.yaml
+++ b/yaml/gens-asterix-dev-201709-mailarchivesao.yaml
@@ -4,6 +4,7 @@ args:
--generate yaml/gens-asterix-dev-201709-mailarchivesao.yaml --root
../ponymail
env:
MOCK_GMTIME: "0"
+ ALT_VERSION: foal
generators:
corpus/asterix-dev-201709-mailarchivesao.mbox:
cluster:
diff --git a/yaml/pars-asterix-dev-201709-mailarchivesao.yaml
b/yaml/pars-asterix-dev-201709-mailarchivesao.yaml
index cea616f..a91005b 100644
--- a/yaml/pars-asterix-dev-201709-mailarchivesao.yaml
+++ b/yaml/pars-asterix-dev-201709-mailarchivesao.yaml
@@ -2,6 +2,8 @@ args:
cmd: tests/test-parsing.py --mbox
corpus/asterix-dev-201709-mailarchivesao.mbox
--generate yaml/pars-asterix-dev-201709-mailarchivesao.yaml --root
../ponymail
parse_html: false
+ env:
+ ALT_VERSION: foal
parsing:
corpus/asterix-dev-201709-mailarchivesao.mbox:
- index: 0
diff --git a/yaml/parsing-httpd-users-200606-part.yaml
b/yaml/parsing-httpd-users-200606-part.yaml
index 4ff5bb4..d55d02b 100644
--- a/yaml/parsing-httpd-users-200606-part.yaml
+++ b/yaml/parsing-httpd-users-200606-part.yaml
@@ -4,6 +4,8 @@ args:
cmd: tests/test-parsing.py --generate parsing-httpd-users-200606-part.yaml
--mbox corpus/httpd-users-200606-part.mbox
--rootdir ../ponymail/
parse_html: false
+ env:
+ ALT_VERSION: foal
parsing:
corpus/httpd-users-200606-part.mbox:
- index: 0