mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-05 00:41:06 +03:00
convert metadata test dumps to YAML for easy comparison
When making code changes related to the metadata parsing, it is useful to see how the internal format has changed by seeing the differences in the dump files. Those files are currently in the binary .pickle format. This just straight converts them to YAML, which is a text format, so that normal diff tools work to see changes. The dump files are named .yaml instead of .yml since .yml is used for hand- edited YAML files for fdroiddata/metadata, while these dump files here are a human readable form of a Python pickle.
This commit is contained in:
parent
ce3efe4168
commit
b1a943d562
7 changed files with 3599 additions and 702 deletions
|
@ -5,9 +5,9 @@
|
|||
import inspect
|
||||
import optparse
|
||||
import os
|
||||
import pickle
|
||||
import sys
|
||||
import unittest
|
||||
import yaml
|
||||
|
||||
localmodule = os.path.realpath(
|
||||
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
|
||||
|
@ -39,15 +39,15 @@ class MetadataTest(unittest.TestCase):
|
|||
apps = fdroidserver.metadata.read_metadata(xref=True)
|
||||
for appid in ('org.smssecure.smssecure', 'org.adaway', 'org.videolan.vlc'):
|
||||
app = apps[appid]
|
||||
savepath = os.path.join('metadata', appid + '.pickle')
|
||||
savepath = os.path.join('metadata', 'dump', appid + '.yaml')
|
||||
frommeta = app.field_dict()
|
||||
self.assertTrue(appid in apps)
|
||||
with open(savepath, 'rb') as f:
|
||||
frompickle = pickle.load(f)
|
||||
with open(savepath, 'r') as f:
|
||||
frompickle = yaml.load(f)
|
||||
self.assertEqual(frommeta, frompickle)
|
||||
# Uncomment to overwrite
|
||||
# with open(savepath, 'wb') as f:
|
||||
# pickle.dump(frommeta, f)
|
||||
# with open(savepath, 'w') as f:
|
||||
# yaml.dump(frommeta, f, default_flow_style=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue