Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/extensions/test/test_createNightlies.py

Issue 29361729: Issue 4574 - Adds Tests to createNightlies platform specific revisions (Closed)
Patch Set: test_creatNightlies.grumble ;P Created Nov. 15, 2016, 5:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/extensions/test/data/diff/downloads.diff ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/test/test_createNightlies.py
===================================================================
--- a/sitescripts/extensions/test/test_createNightlies.py
+++ b/sitescripts/extensions/test/test_createNightlies.py
@@ -9,30 +9,77 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
"""Tests for create nightlies script."""
+import os
Sebastian Noack 2016/11/16 15:41:04 There should be a blank line below the docstring,
Jon Sonesen 2016/11/18 09:45:52 Yeah, I will remove the docstrings
+from subprocess import CalledProcessError
+
import pytest
from sitescripts.extensions.bin import createNightlies
from sitescripts.utils import get_config
-@pytest.fixture()
-def config(hg_dir):
+@pytest.fixture(scope='session')
+def nightlydir(hg_dir):
+ return hg_dir.join('adblockplusnightly')
+
+
+@pytest.fixture(scope='session')
+def config(hg_dir, nightlydir):
+ """Set and return config obj for NightlyBuild"""
config = get_config()
config.type = 'safari'
- config.repository = str(hg_dir.join('adblockplusnightly'))
config.revision = 'safari'
+ config.repositoryName = 'adblockplusnightly'
+ config.repository = nightlydir.strpath
return config
-@pytest.fixture()
+@pytest.fixture(scope='session')
def nightlybuild(config):
return createNightlies.NightlyBuild(config)
+@pytest.fixture(scope='session')
+def current_revision(nightlydir):
+ return '1291590ddd0f'
Sebastian Noack 2016/11/16 15:41:04 Since this is hard-coded, why not simply using a g
Jon Sonesen 2016/11/18 12:55:41 This is because it follows the pattern of pytest..
+
+
def test_nightly_object_bookmark(nightlybuild):
assert nightlybuild.config.revision == 'safari'
+
+
+def test_current_revision(current_revision, nightlybuild):
+ assert nightlybuild.revision == current_revision
+
+
+def test_copy_repository(nightlybuild, nightlydir):
+ nightlybuild.copyRepository()
+ assert os.listdir(nightlybuild.tempdir) == ['.hg', 'README.txt']
+
+
+def test_get_changes(nightlybuild, nightlydir):
+ """
+ The bookmark 'safari' contains only 2 revisions
Vasily Kuznetsov 2016/11/15 17:22:42 This explains the implementation details of the te
Jon Sonesen 2016/11/16 10:58:21 Done.
Sebastian Noack 2016/11/16 15:41:04 Did you address that? I don't see a new patchset.
Jon Sonesen 2016/11/18 09:45:52 oops,never uploaded patch set
+ default contains 51 so here we ensure that erroneous changes
+ are not returned
+ """
+ for change in nightlybuild.getChanges():
+ assert change['revision'] < '2'
+
+ nightlybuild.config.revision = 'default'
+ for change in nightlybuild.getChanges():
+ assert change['revision'] > '1'
+
+
+def test_missing_bookmark(config):
+ config.revision = 'foo'
+ config.type = 'type'
+ try:
+ createNightlies.NightlyBuild(config)
+ except CalledProcessError as e:
+ assert e.returncode == 255
« no previous file with comments | « sitescripts/extensions/test/data/diff/downloads.diff ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld