diff --git a/.gitignore b/.gitignore index b9cc85a7..aeb27193 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ __pycache__/ *.zip qgis_plugin_ci_testing/i18n +qgis_plugin_ci_testing/resources_rc.py + .tokens diff --git a/test/plugins.xml.expected b/test/plugins.xml.expected index 2c397ab0..2098504f 100644 --- a/test/plugins.xml.expected +++ b/test/plugins.xml.expected @@ -11,11 +11,11 @@ https://github.com/opengisch/qgis-plugin-ci/releases/download/0.1.2/qgis-plugin-ci-0.1.2.zip Denis Rouzaud 1985-07-21 - 2019-07-16 + __TODAY__ True False https://github.com/opengisch/qgis-plugin-ci/issues https://github.com/opengisch/qgis-plugin-ci - \ No newline at end of file + diff --git a/test/test_release.py b/test/test_release.py index c86e560d..e08bacd4 100644 --- a/test/test_release.py +++ b/test/test_release.py @@ -12,7 +12,7 @@ from qgispluginci.release import release from qgispluginci.translation import Translation from qgispluginci.exceptions import GithubReleaseNotFound - +from qgispluginci.utils import replace_in_file # if change, also update on .travis.yml RELEASE_VERSION_TEST = '0.1.2' @@ -29,8 +29,12 @@ def setUp(self): if self.github_token: print('init Github') self.repo = Github(self.github_token).get_repo('opengisch/qgis-plugin-ci') + self.clean_assets() def tearDown(self): + self.clean_assets() + + def clean_assets(self): if self.repo: rel = None try: @@ -58,7 +62,8 @@ def test_release_upload_github(self): _, xml_repo = mkstemp(suffix='.xml') url = 'https://github.com/opengisch/qgis-plugin-ci/releases/download/{}/plugins.xml'.format(RELEASE_VERSION_TEST) urllib.request.urlretrieve(url, xml_repo) - self.assertTrue(filecmp.cmp('test/plugins.xml.expected', xml_repo)) + replace_in_file(xml_repo, r'[\w-]+<\/update_date>', '__TODAY__') + self.assertTrue(filecmp.cmp('test/plugins.xml.expected', xml_repo, shallow=False)) # compare archive file size gh_release = self.repo.get_release(id=RELEASE_VERSION_TEST) @@ -66,11 +71,13 @@ def test_release_upload_github(self): fs = os.path.getsize(archive_name) print('size: ', fs) self.assertGreater(fs, 0, 'archive file size must be > 0') + found = False for a in gh_release.get_assets(): if a.name == archive_name: + found = True self.assertEqual(fs, a.size, 'asset size doesn\'t march archive size.') break - self.assertTrue(False, 'asset not found') + self.assertTrue(found, 'asset not found')