[Pkg-mozext-commits] [requestpolicy] 47/80: prepare for Marionette tests, see #641

David Prévot taffit at moszumanska.debian.org
Sun Jul 5 15:02:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit c9f3074a4e25294feecdbabd8f23ddb827ee3dab
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Jun 18 02:51:07 2015 +0200

    prepare for Marionette tests, see #641
    
    This commit prepares for Marionette tests:
    * The Makefile will automatically set up a virtualenv
       environment (venv). That venv will also be used for
       `make run`.
    * The basic directory structure in `tests/marionette`
       is created.
---
 .gitignore                                       |  3 ++
 Makefile                                         | 48 +++++++++++++++++++++---
 requirements.txt                                 |  2 +
 tests/marionette/rp_puppeteer/__init__.py        |  1 +
 tests/marionette/rp_puppeteer/api/__init__.py    |  1 +
 tests/marionette/rp_puppeteer/tests/manifest.ini |  1 +
 tests/marionette/rp_puppeteer/ui/__init__.py     |  1 +
 tests/marionette/rp_ui_harness/__init__.py       |  1 +
 tests/marionette/tests/manifest.ini              |  1 +
 tests/mozrunner-prefs.ini                        |  4 ++
 10 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index d9daf53..d1c6ccb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,9 @@
 *.xpi
 *.bak*
 *.orig
+*.pyc
+
+gecko.log
 
 # build and dist directories in the root folder
 /build/
diff --git a/Makefile b/Makefile
index b8502c7..780b824 100644
--- a/Makefile
+++ b/Makefile
@@ -410,6 +410,25 @@ $(deleted_files): FORCE
 	@# delete parent dirs if empty:
 	@rmdir --parents --ignore-fail-on-non-empty $(dir $@)
 
+# ____________________________
+# virtual python environments
+# for running and unit-testing
+#
+
+.PHONY: venv
+
+venv: .venv/bin/activate
+.venv/bin/activate: requirements.txt
+	test -d .venv || virtualenv --prompt='(RP)' .venv
+
+	@# With the `touch` command, this target is only executed
+	@# when "requirements.txt" changes
+	( \
+	source .venv/bin/activate ; \
+	pip install -r requirements.txt ; \
+	touch --no-create .venv/bin/activate ; \
+	)
+
 # ___________
 # run firefox
 #
@@ -421,8 +440,11 @@ mozrunner_args += --preferences=$(mozrunner_prefs_ini):dev
 mozrunner_args += $(moz_args)
 
 .PHONY: run
-run: $(moz_xpi) $(dev_helper__xpi_file)
-	mozrunner $(mozrunner_args)
+run: venv $(moz_xpi) $(dev_helper__xpi_file)
+	( \
+	source .venv-mozmill/bin/activate ; \
+	mozrunner $(mozrunner_args) ; \
+	)
 
 
 # ____________
@@ -438,8 +460,8 @@ mozmill_rpc_test_dir := $(mozmill_tests_dir)/firefox/tests/addons/rpcontinued at re
 # Default mozmill manifest to use for testing
 mm_manifest := manifest.ini
 
-.PHONY: check test mozmill
-check test: mozmill
+.PHONY: check test mozmill marionette mozmill-dirs
+check test: mozmill marionette
 
 mozmill: $(moz_xpi) $(dev_helper__xpi_file) mozmill-dirs
 	mozmill -a $(moz_xpi) -a $(dev_helper__xpi_file) -b $(app_binary) \
@@ -447,7 +469,6 @@ mozmill: $(moz_xpi) $(dev_helper__xpi_file) mozmill-dirs
 
 
 
-.PHONY: mozmill-dirs
 mozmill-dirs: $(mozmill_tests_dir) \
 	$(mozmill_rpc_test_dir) \
 	$(mozmill_rpc_test_dir)/mozmill-tests \
@@ -466,6 +487,23 @@ $(mozmill_rpc_test_dir)/data: $(mozmill_rpc_test_dir)
 	|| ln -ns ../../ tests/mozmill/data
 
 
+
+marionette_tests := tests/marionette/rp_puppeteer/tests/manifest.ini
+marionette_tests += tests/marionette/tests/manifest.ini
+
+
+.PHONY: marionette
+marionette: venv $(unit_testing__xpi_file) $(dev_helper__xpi_file) $(dummy_ext__xpi_file)
+	@# Due to Mozilla Bug 1173502, the profile needs to be created and
+	@# removed directly.
+	( \
+	source .venv/bin/activate ; \
+	export PYTHONPATH=tests/marionette/ ; \
+	profile_dir=`mozprofile -a $(unit_testing__xpi_file) -a $(dev_helper__xpi_file) --preferences=$(mozrunner_prefs_ini):marionette` ; \
+	firefox-ui-tests --binary=$(app_binary) --profile=$$profile_dir $(marionette_tests) ; \
+	rm -rf $$profile_dir ; \
+	)
+
 # ________________
 # "helper" targets
 #
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..440eeb5
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+-e git+https://github.com/mozilla/firefox-ui-tests.git#egg=firefox-ui-tests
+mozrunner >= 6.2
diff --git a/tests/marionette/rp_puppeteer/__init__.py b/tests/marionette/rp_puppeteer/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/marionette/rp_puppeteer/api/__init__.py b/tests/marionette/rp_puppeteer/api/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/api/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/marionette/rp_puppeteer/tests/manifest.ini b/tests/marionette/rp_puppeteer/tests/manifest.ini
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/tests/manifest.ini
@@ -0,0 +1 @@
+
diff --git a/tests/marionette/rp_puppeteer/ui/__init__.py b/tests/marionette/rp_puppeteer/ui/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/rp_puppeteer/ui/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/marionette/rp_ui_harness/__init__.py b/tests/marionette/rp_ui_harness/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/rp_ui_harness/__init__.py
@@ -0,0 +1 @@
+
diff --git a/tests/marionette/tests/manifest.ini b/tests/marionette/tests/manifest.ini
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/marionette/tests/manifest.ini
@@ -0,0 +1 @@
+
diff --git a/tests/mozrunner-prefs.ini b/tests/mozrunner-prefs.ini
index 972129a..c716fe6 100644
--- a/tests/mozrunner-prefs.ini
+++ b/tests/mozrunner-prefs.ini
@@ -22,3 +22,7 @@ extensions.requestpolicy.defaultPolicy.allow=false
 ; enable e10s (multiprocess firefox)
 browser.tabs.remote.autostart.1:true
 browser.displayedE10SNotice:4
+
+[marionette]
+# By default, do not show the setup tab.
+extensions.requestpolicy.welcomeWindowShown=true

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list