Skip to content

Commit

Permalink
Merge pull request #396 from plone/fix-plone-version-check-regexp
Browse files Browse the repository at this point in the history
Fixed regular expression in test for Plone version.
  • Loading branch information
mauritsvanrees committed Feb 15, 2018
2 parents cb26272 + 0f5e695 commit 194955e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ New features:

Bug fixes:

- *add item here*
- Fixed regular expression in test for Plone version. [maurits]


1.8.2 (2018-01-17)
Expand Down
21 changes: 8 additions & 13 deletions src/plone/api/tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ class ExampleException(Exception):
('rrr', ('Manager')),
)

# Version of Zope and Plone should be something like
# 'X.Y' or 'X.Y.Z' or 'X.Y.Z.A'
# It could also include a package status id (Alpha, Beta or RC).
# When run against coredev, we may have a .devN suffix as well.
version_regexp = '^(\d+(\.\d+){1,3})(a\d+|b\d+|rc\d+)?(\.dev\d)?$'


class HasProtectedMethods(SimpleItem):

Expand Down Expand Up @@ -426,24 +432,13 @@ def test_plone_version(self):
"""Tests that plone_version() returns Plone version."""
from plone.api.env import plone_version
self.assertTrue(isinstance(plone_version(), str))
# version should be something like 'X.Y' or 'X.Y.Z'
# it could also include a package status id (Alpha, Beta or RC)
# When run against coredev, we may have a .devN suffix as well.
self.assertRegexpMatches(
plone_version(),
'^(\d+\.\d+|\d+\.\d+\.\d+)(a\d+|b\d+|rc\d+)?(\.dev\d)?$',
)
self.assertRegexpMatches(plone_version(), version_regexp)

def test_zope_version(self):
"""Tests that zope_version() returns Zope version."""
from plone.api.env import zope_version
self.assertTrue(isinstance(zope_version(), str))
# version should be something like 'X.Y' or 'X.Y.Z'
# it could also include a package status id (Alpha, Beta or RC)
self.assertRegexpMatches(
zope_version(),
'^(\d+\.\d+|\d+\.\d+\.\d+)(a\d+|b\d+|rc\d+)?(\.dev\d)?$',
)
self.assertRegexpMatches(zope_version(), version_regexp)

def test_adopt_user_different_username(self):
user = api.user.get(userid=TEST_USER_ID)
Expand Down

0 comments on commit 194955e

Please sign in to comment.