All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][v2 1/8] toaster: replace viewkeys() -> keys()
@ 2016-06-07 15:37 Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 2/8] toaster: fix migrations Elliot Smith
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Python 3 doesn't have dict.viewkeys method, renaming
to keys().

[YOCTO #9584]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index d59d6a5..d5ba629 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -1067,7 +1067,7 @@ class BuildInfoHelper(object):
 
         for t in self.internal_state['targets']:
             if t.is_image == True:
-                output_files = list(evdata.viewkeys())
+                output_files = list(evdata.keys())
                 for output in output_files:
                     if t.target in output and 'rootfs' in output and not output.endswith(".manifest"):
                         self.orm_wrapper.save_target_image_file_information(t, output, evdata[output])
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 2/8] toaster: fix migrations
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-09 17:07   ` Michael Wood
  2016-06-07 15:37 ` [PATCH][v2 3/8] toaster: decode response content Elliot Smith
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
 .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
 create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py

diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
new file mode 100644
index 0000000..3d90629
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bldcontrol', '0003_add_cancelling_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='bbstate',
+            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='betype',
+            field=models.IntegerField(choices=[(0, 'local')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='lock',
+            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
+        ),
+        migrations.AlterField(
+            model_name='buildrequest',
+            name='state',
+            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
+        ),
+    ]
diff --git a/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
new file mode 100644
index 0000000..b472e7c
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('orm', '0006_add_cancelled_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='build',
+            name='outcome',
+            field=models.IntegerField(default=2, choices=[(0, 'Succeeded'), (1, 'Failed'), (2, 'In Progress'), (3, 'Cancelled')]),
+        ),
+        migrations.AlterField(
+            model_name='helptext',
+            name='area',
+            field=models.IntegerField(choices=[(0, 'variable')]),
+        ),
+        migrations.AlterField(
+            model_name='layer',
+            name='summary',
+            field=models.TextField(default=None, null=True, help_text='One-line description of the layer'),
+        ),
+        migrations.AlterField(
+            model_name='layer_version',
+            name='local_path',
+            field=models.FilePathField(default='/', max_length=1024),
+        ),
+        migrations.AlterField(
+            model_name='layersource',
+            name='sourcetype',
+            field=models.IntegerField(choices=[(0, 'local'), (1, 'layerindex'), (2, 'imported')]),
+        ),
+        migrations.AlterField(
+            model_name='logmessage',
+            name='level',
+            field=models.IntegerField(default=0, choices=[(0, 'info'), (1, 'warn'), (2, 'error'), (3, 'critical'), (-1, 'toaster exception')]),
+        ),
+        migrations.AlterField(
+            model_name='package',
+            name='installed_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='package_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'depends'), (3, 'recommends'), (2, 'recommends'), (4, 'suggests'), (5, 'provides'), (6, 'replaces'), (7, 'conflicts')]),
+        ),
+        migrations.AlterField(
+            model_name='recipe_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'rdepends')]),
+        ),
+        migrations.AlterField(
+            model_name='release',
+            name='branch_name',
+            field=models.CharField(default='', max_length=50),
+        ),
+        migrations.AlterField(
+            model_name='releasedefaultlayer',
+            name='layer_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='target_file',
+            name='inodetype',
+            field=models.IntegerField(choices=[(1, 'regular'), (2, 'directory'), (3, 'symlink'), (4, 'socket'), (5, 'fifo'), (6, 'character'), (7, 'block')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='outcome',
+            field=models.IntegerField(default=-1, choices=[(-1, 'Not Available'), (0, 'Succeeded'), (1, 'Covered'), (2, 'Cached'), (3, 'Prebuilt'), (4, 'Failed'), (5, 'Empty')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='script_type',
+            field=models.IntegerField(default=0, choices=[(0, 'N/A'), (2, 'Python'), (3, 'Shell')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='sstate_result',
+            field=models.IntegerField(default=0, choices=[(0, 'Not Applicable'), (1, 'File not in cache'), (2, 'Failed'), (3, 'Succeeded')]),
+        ),
+    ]
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 3/8] toaster: decode response content
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 2/8] toaster: fix migrations Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 4/8] toaster: fix incorrect file mode Elliot Smith
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Decoded response content to str to pass it to json.load as it breaks
in Python 3 with this error:
   TypeError: expected bytes, bytearray or buffer compatible object

[YOCTO #9584]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/tests.py | 38 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 9af1018..722b383 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -77,7 +77,7 @@ class ViewTests(TestCase):
         self.assertEqual(response.status_code, 200)
         self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
 
         self.assertTrue("error" in data)
         self.assertEqual(data["error"], "ok")
@@ -106,7 +106,7 @@ class ViewTests(TestCase):
             self.assertEqual(response.status_code, 200)
             self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-            data = json.loads(response.content)
+            data = json.loads(response.content.decode('utf-8'))
 
             self.assertTrue("error" in data)
             self.assertEqual(data["error"], "ok")
@@ -157,26 +157,26 @@ class ViewTests(TestCase):
                 'project_id': self.project.id,
                 'dir_path' : "/path/in/repository"}
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertEqual(response.status_code, 200)
         self.assertEqual(data["error"], "ok")
 
         #Test to verify import of a layer successful
         args['name'] = "meta-oe"
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertTrue(data["error"], "ok")
 
         #Test for html tag in the data
         args['<'] = "testing html tag"
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
         #Empty data passed
         args = {}
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_custom_ok(self):
@@ -186,7 +186,7 @@ class ViewTests(TestCase):
                   'base': self.recipe1.id}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertEqual(data['error'], 'ok')
         self.assertTrue('url' in data)
         # get recipe from the database
@@ -202,7 +202,7 @@ class ViewTests(TestCase):
                        {'name': 'custom', 'project': self.project.id}]:
             response = self.client.post(url, params)
             self.assertEqual(response.status_code, 200)
-            data = json.loads(response.content)
+            data = json.loads(response.content.decode('utf-8'))
             self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_wrong_project(self):
@@ -211,7 +211,7 @@ class ViewTests(TestCase):
         params = {'name': 'custom', 'project': 0, "base": self.recipe1.id}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_wrong_base(self):
@@ -220,7 +220,7 @@ class ViewTests(TestCase):
         params = {'name': 'custom', 'project': self.project.id, "base": 0}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_details(self):
@@ -235,7 +235,7 @@ class ViewTests(TestCase):
                              'project_id': self.project.id,
                             }
                    }
-        self.assertEqual(json.loads(response.content), expected)
+        self.assertEqual(json.loads(response.content.decode('utf-8')), expected)
 
     def test_xhr_custom_del(self):
         """Test deleting custom recipe"""
@@ -248,12 +248,12 @@ class ViewTests(TestCase):
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content), {"error": "ok"})
+        self.assertEqual(json.loads(response.content.decode('utf-8')), {"error": "ok"})
         # try to delete not-existent recipe
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(json.loads(response.content)["error"], "ok")
+        self.assertNotEqual(json.loads(response.content.decode('utf-8'))["error"], "ok")
 
     def test_xhr_custom_packages(self):
         """Test adding and deleting package to a custom recipe"""
@@ -263,7 +263,7 @@ class ViewTests(TestCase):
                                                  self.cust_package.id)))
 
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content),
+        self.assertEqual(json.loads(response.content.decode('utf-8')),
                          {"error": "ok"})
         self.assertEqual(self.customr.appends_set.first().name,
                          self.cust_package.name)
@@ -274,7 +274,7 @@ class ViewTests(TestCase):
 
         response = self.client.delete(del_url)
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content), {"error": "ok"})
+        self.assertEqual(json.loads(response.content.decode('utf-8')), {"error": "ok"})
         all_packages = self.customr.get_all_packages().values_list('pk',
                                                                    flat=True)
 
@@ -286,7 +286,7 @@ class ViewTests(TestCase):
 
         response = self.client.delete(del_url)
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(json.loads(response.content)["error"], "ok")
+        self.assertNotEqual(json.loads(response.content.decode('utf-8'))["error"], "ok")
 
     def test_xhr_custom_packages_err(self):
         """Test error conditions of xhr_customrecipe_packages"""
@@ -297,7 +297,7 @@ class ViewTests(TestCase):
             for method in (self.client.put, self.client.delete):
                 response = method(url)
                 self.assertEqual(response.status_code, 200)
-                self.assertNotEqual(json.loads(response.content),
+                self.assertNotEqual(json.loads(response.content.decode('utf-8')),
                                     {"error": "ok"})
 
     def test_download_custom_recipe(self):
@@ -316,7 +316,7 @@ class ViewTests(TestCase):
         table = SoftwareRecipesTable()
         request = RequestFactory().get('/foo/', {'format': 'json'})
         response = table.get(request, pid=self.project.id)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
 
         recipes = Recipe.objects.filter(Q(is_image=False))
         self.assertTrue(len(recipes) > 1,
@@ -372,7 +372,7 @@ class ViewTests(TestCase):
                     'target_id': 1}
 
             response = table.get(request, **args)
-            return json.loads(response.content)
+            return json.loads(response.content.decode('utf-8'))
 
         def get_text_from_td(td):
             """If we have html in the td then extract the text portion"""
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 4/8] toaster: fix incorrect file mode
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 2/8] toaster: fix migrations Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 3/8] toaster: decode response content Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 5/8] toaster: fix test_toaster_tables Elliot Smith
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Python 3 complains about 'wa' mode this way:
 ValueError: must have exactly one of create/read/write/append mode

Fixed by using 'a' mode.

[YOCTO #9584]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 722b383..31f1431 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -304,7 +304,7 @@ class ViewTests(TestCase):
         """Download the recipe file generated for the custom image"""
 
         # Create a dummy recipe file for the custom image generation to read
-        open("/tmp/a_recipe.bb", 'wa').close()
+        open("/tmp/a_recipe.bb", 'a').close()
         response = self.client.get(reverse('customrecipedownload',
                                            args=(self.project.id,
                                                  self.customr.id)))
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 5/8] toaster: fix test_toaster_tables
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
                   ` (2 preceding siblings ...)
  2016-06-07 15:37 ` [PATCH][v2 4/8] toaster: fix incorrect file mode Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 6/8] toaster: fix broken reference to urllib Elliot Smith
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Removed unneeded code as it causes the following error in Python 3:
    TypeError: expected bytes, bytearray or buffer compatible object

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/tests.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 31f1431..2cd2c7d 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -382,12 +382,6 @@ class ViewTests(TestCase):
             else:
                 ret = BeautifulSoup(td).text
 
-            # We change the td into ascii as a way to remove characters
-            # such as \xa0 (non break space) which mess with the ordering
-            # comparisons
-            ret.strip().encode('ascii',
-                               errors='replace').replace('?', ' ')
-            # Case where the td is empty
             if len(ret):
                 return "0"
             else:
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 6/8] toaster: fix broken reference to urllib
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
                   ` (3 preceding siblings ...)
  2016-06-07 15:37 ` [PATCH][v2 5/8] toaster: fix test_toaster_tables Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 7/8] toaster-tests: fix tests for latest Selenium version Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 8/8] toaster: open image files in binary mode when sending in response Elliot Smith
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

The code previously imported urllib to make use of querystring
quoting, but was modified to support Python 3. During this
process, the reference to urllib was not fixed, which resulted
in table filters breaking.

Remove the reference to urllib (which is no longer imported)
and instead reference the imported unquote_plus() function.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/widgets.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index 4276c2a..005a562 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -219,7 +219,7 @@ class ToasterTable(TemplateView):
 
         try:
             filter_name, action_name = filters.split(':')
-            action_params = urllib.unquote_plus(filter_value)
+            action_params = unquote_plus(filter_value)
         except ValueError:
             return
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 7/8] toaster-tests: fix tests for latest Selenium version
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
                   ` (4 preceding siblings ...)
  2016-06-07 15:37 ` [PATCH][v2 6/8] toaster: fix broken reference to urllib Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  2016-06-07 15:37 ` [PATCH][v2 8/8] toaster: open image files in binary mode when sending in response Elliot Smith
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

Previously, we didn't specify a specific version of Selenium.
When upgrading to Python 3 and installing Selenium to work with it,
the JS unit test broke, as the report format produced by Selenium
had changed.

Modify the test so that it works with the latest Selenium report
format.

Add a note to the README that the given Selenium version should
be used to prevent unexpected test failures.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/tests/browser/README                | 7 ++++---
 bitbake/lib/toaster/tests/browser/test_js_unit_tests.py | 8 ++++----
 bitbake/lib/toaster/toastergui/static/js/tests/test.js  | 8 --------
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/bitbake/lib/toaster/tests/browser/README b/bitbake/lib/toaster/tests/browser/README
index 63e8169..f57154e 100644
--- a/bitbake/lib/toaster/tests/browser/README
+++ b/bitbake/lib/toaster/tests/browser/README
@@ -4,10 +4,11 @@ These tests require Selenium to be installed in your Python environment.
 
 The simplest way to install this is via pip:
 
-  pip install selenium
+  pip install selenium==2.53.2
 
-Alternatively, if you used pip to install the libraries required by Toaster,
-selenium will already be installed.
+Note that if you use other versions of Selenium, some of the tests (such as
+tests.browser.test_js_unit_tests.TestJsUnitTests) may fail, as these rely on
+a Selenium test report with a version-specific format.
 
 To run tests against Chrome:
 
diff --git a/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py b/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py
index e63da8e..3c0b962 100644
--- a/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py
+++ b/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py
@@ -38,11 +38,11 @@ class TestJsUnitTests(SeleniumTestCase):
     def test_that_js_unit_tests_pass(self):
         url = reverse('js-unit-tests')
         self.get(url)
-        self.wait_until_present('#tests-failed')
+        self.wait_until_present('#qunit-testresult .failed')
 
-        failed = self.find("#tests-failed").text
-        passed = self.find("#tests-passed").text
-        total = self.find("#tests-total").text
+        failed = self.find("#qunit-testresult .failed").text
+        passed = self.find("#qunit-testresult .passed").text
+        total = self.find("#qunit-testresult .total").text
 
         logger.info("Js unit tests completed %s out of %s passed, %s failed",
                     passed,
diff --git a/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
index 2b62118..44b7522 100644
--- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js
+++ b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
@@ -2,14 +2,6 @@
 /* Unit tests for Toaster's JS */
 
 /* libtoaster tests */
-QUnit.done(function(details){
-    /* Selenium test will look for these elements to get the results */
-  var body = $('body');
-  body.append("<span id='tests-failed'>"+details.failed+"</span>");
-  body.append("<span id='tests-passed'>"+details.passed+"</span>");
-  body.append("<span id='tests-total'>"+details.total+"</span>");
-});
-
 QUnit.test("Layer alert notification", function(assert) {
   var layer = {
     "layerdetailurl":"/toastergui/project/1/layer/22",
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH][v2 8/8] toaster: open image files in binary mode when sending in response
  2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
                   ` (5 preceding siblings ...)
  2016-06-07 15:37 ` [PATCH][v2 7/8] toaster-tests: fix tests for latest Selenium version Elliot Smith
@ 2016-06-07 15:37 ` Elliot Smith
  6 siblings, 0 replies; 10+ messages in thread
From: Elliot Smith @ 2016-06-07 15:37 UTC (permalink / raw)
  To: toaster

The view code for downloading image files used the "r" flag
to read the file, then used the open file object to form the
HTTP response.

While this worked in Python 2, Python 3 appears to be more strict
about this sort of thing, and Django throws a UnicodeDecodeError
when a file opened this way is used in a response.

Open the file with the "b" flag (binary mode) so that Django can
correctly convert the binary file handle to an HTTP response.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 1f908ea..16f98ee 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2339,7 +2339,7 @@ if True:
             )
 
             if file_name and response_file_name:
-                fsock = open(file_name, "r")
+                fsock = open(file_name, "rb")
                 content_type = MimeTypeFinder.get_mimetype(file_name)
 
                 response = HttpResponse(fsock, content_type = content_type)
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH][v2 2/8] toaster: fix migrations
  2016-06-07 15:37 ` [PATCH][v2 2/8] toaster: fix migrations Elliot Smith
@ 2016-06-09 17:07   ` Michael Wood
  2016-06-10  7:16     ` Bartosh, Eduard
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Wood @ 2016-06-09 17:07 UTC (permalink / raw)
  To: Elliot Smith, toaster; +Cc: Bartosh, Eduard

Is this patch needed? I see this is in master already:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake?id=15bb3d4e7fd33a921e9b0681297dfee6986a66eb

On 07/06/16 16:37, Elliot Smith wrote:
> From: Ed Bartosh <ed.bartosh@linux.intel.com>
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>   .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
>   .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
>   2 files changed, 123 insertions(+)
>   create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
>   create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
>
> diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
> new file mode 100644
> index 0000000..3d90629
> --- /dev/null
> +++ b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
> @@ -0,0 +1,34 @@
> +# -*- coding: utf-8 -*-
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('bldcontrol', '0003_add_cancelling_state'),
> +    ]
> +
> +    operations = [
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='bbstate',
> +            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='betype',
> +            field=models.IntegerField(choices=[(0, 'local')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='lock',
> +            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildrequest',
> +            name='state',
> +            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
> +        ),
> +    ]
> diff --git a/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
> new file mode 100644
> index 0000000..b472e7c
> --- /dev/null
> +++ b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
> @@ -0,0 +1,89 @@
> +# -*- coding: utf-8 -*-
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('orm', '0006_add_cancelled_state'),
> +    ]
> +
> +    operations = [
> +        migrations.AlterField(
> +            model_name='build',
> +            name='outcome',
> +            field=models.IntegerField(default=2, choices=[(0, 'Succeeded'), (1, 'Failed'), (2, 'In Progress'), (3, 'Cancelled')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='helptext',
> +            name='area',
> +            field=models.IntegerField(choices=[(0, 'variable')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='layer',
> +            name='summary',
> +            field=models.TextField(default=None, null=True, help_text='One-line description of the layer'),
> +        ),
> +        migrations.AlterField(
> +            model_name='layer_version',
> +            name='local_path',
> +            field=models.FilePathField(default='/', max_length=1024),
> +        ),
> +        migrations.AlterField(
> +            model_name='layersource',
> +            name='sourcetype',
> +            field=models.IntegerField(choices=[(0, 'local'), (1, 'layerindex'), (2, 'imported')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='logmessage',
> +            name='level',
> +            field=models.IntegerField(default=0, choices=[(0, 'info'), (1, 'warn'), (2, 'error'), (3, 'critical'), (-1, 'toaster exception')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='package',
> +            name='installed_name',
> +            field=models.CharField(default='', max_length=100),
> +        ),
> +        migrations.AlterField(
> +            model_name='package_dependency',
> +            name='dep_type',
> +            field=models.IntegerField(choices=[(0, 'depends'), (1, 'depends'), (3, 'recommends'), (2, 'recommends'), (4, 'suggests'), (5, 'provides'), (6, 'replaces'), (7, 'conflicts')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='recipe_dependency',
> +            name='dep_type',
> +            field=models.IntegerField(choices=[(0, 'depends'), (1, 'rdepends')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='release',
> +            name='branch_name',
> +            field=models.CharField(default='', max_length=50),
> +        ),
> +        migrations.AlterField(
> +            model_name='releasedefaultlayer',
> +            name='layer_name',
> +            field=models.CharField(default='', max_length=100),
> +        ),
> +        migrations.AlterField(
> +            model_name='target_file',
> +            name='inodetype',
> +            field=models.IntegerField(choices=[(1, 'regular'), (2, 'directory'), (3, 'symlink'), (4, 'socket'), (5, 'fifo'), (6, 'character'), (7, 'block')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='outcome',
> +            field=models.IntegerField(default=-1, choices=[(-1, 'Not Available'), (0, 'Succeeded'), (1, 'Covered'), (2, 'Cached'), (3, 'Prebuilt'), (4, 'Failed'), (5, 'Empty')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='script_type',
> +            field=models.IntegerField(default=0, choices=[(0, 'N/A'), (2, 'Python'), (3, 'Shell')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='sstate_result',
> +            field=models.IntegerField(default=0, choices=[(0, 'Not Applicable'), (1, 'File not in cache'), (2, 'Failed'), (3, 'Succeeded')]),
> +        ),
> +    ]



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH][v2 2/8] toaster: fix migrations
  2016-06-09 17:07   ` Michael Wood
@ 2016-06-10  7:16     ` Bartosh, Eduard
  0 siblings, 0 replies; 10+ messages in thread
From: Bartosh, Eduard @ 2016-06-10  7:16 UTC (permalink / raw)
  To: Wood, Michael G, Smith, Elliot, toaster

If toaster starts without it then it's not needed.
It didn't work for me until I run manage.py makemirgrations, but it could be that I tried it without my previous patch in master.

-----Original Message-----
From: Michael Wood [mailto:michael.g.wood@intel.com] 
Sent: Thursday, June 9, 2016 8:07 PM
To: Smith, Elliot <elliot.smith@intel.com>; toaster@yoctoproject.org
Cc: Bartosh, Eduard <eduard.bartosh@intel.com>
Subject: Re: [Toaster] [PATCH][v2 2/8] toaster: fix migrations

Is this patch needed? I see this is in master already:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake?id=15bb3d4e7fd33a921e9b0681297dfee6986a66eb

On 07/06/16 16:37, Elliot Smith wrote:
> From: Ed Bartosh <ed.bartosh@linux.intel.com>
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>   .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
>   .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
>   2 files changed, 123 insertions(+)
>   create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
>   create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
>
> diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
> new file mode 100644
> index 0000000..3d90629
> --- /dev/null
> +++ b/bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
> @@ -0,0 +1,34 @@
> +# -*- coding: utf-8 -*-
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('bldcontrol', '0003_add_cancelling_state'),
> +    ]
> +
> +    operations = [
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='bbstate',
> +            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='betype',
> +            field=models.IntegerField(choices=[(0, 'local')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildenvironment',
> +            name='lock',
> +            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='buildrequest',
> +            name='state',
> +            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
> +        ),
> +    ]
> diff --git a/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
> new file mode 100644
> index 0000000..b472e7c
> --- /dev/null
> +++ b/bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
> @@ -0,0 +1,89 @@
> +# -*- coding: utf-8 -*-
> +from __future__ import unicode_literals
> +
> +from django.db import migrations, models
> +
> +
> +class Migration(migrations.Migration):
> +
> +    dependencies = [
> +        ('orm', '0006_add_cancelled_state'),
> +    ]
> +
> +    operations = [
> +        migrations.AlterField(
> +            model_name='build',
> +            name='outcome',
> +            field=models.IntegerField(default=2, choices=[(0, 'Succeeded'), (1, 'Failed'), (2, 'In Progress'), (3, 'Cancelled')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='helptext',
> +            name='area',
> +            field=models.IntegerField(choices=[(0, 'variable')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='layer',
> +            name='summary',
> +            field=models.TextField(default=None, null=True, help_text='One-line description of the layer'),
> +        ),
> +        migrations.AlterField(
> +            model_name='layer_version',
> +            name='local_path',
> +            field=models.FilePathField(default='/', max_length=1024),
> +        ),
> +        migrations.AlterField(
> +            model_name='layersource',
> +            name='sourcetype',
> +            field=models.IntegerField(choices=[(0, 'local'), (1, 'layerindex'), (2, 'imported')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='logmessage',
> +            name='level',
> +            field=models.IntegerField(default=0, choices=[(0, 'info'), (1, 'warn'), (2, 'error'), (3, 'critical'), (-1, 'toaster exception')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='package',
> +            name='installed_name',
> +            field=models.CharField(default='', max_length=100),
> +        ),
> +        migrations.AlterField(
> +            model_name='package_dependency',
> +            name='dep_type',
> +            field=models.IntegerField(choices=[(0, 'depends'), (1, 'depends'), (3, 'recommends'), (2, 'recommends'), (4, 'suggests'), (5, 'provides'), (6, 'replaces'), (7, 'conflicts')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='recipe_dependency',
> +            name='dep_type',
> +            field=models.IntegerField(choices=[(0, 'depends'), (1, 'rdepends')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='release',
> +            name='branch_name',
> +            field=models.CharField(default='', max_length=50),
> +        ),
> +        migrations.AlterField(
> +            model_name='releasedefaultlayer',
> +            name='layer_name',
> +            field=models.CharField(default='', max_length=100),
> +        ),
> +        migrations.AlterField(
> +            model_name='target_file',
> +            name='inodetype',
> +            field=models.IntegerField(choices=[(1, 'regular'), (2, 'directory'), (3, 'symlink'), (4, 'socket'), (5, 'fifo'), (6, 'character'), (7, 'block')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='outcome',
> +            field=models.IntegerField(default=-1, choices=[(-1, 'Not Available'), (0, 'Succeeded'), (1, 'Covered'), (2, 'Cached'), (3, 'Prebuilt'), (4, 'Failed'), (5, 'Empty')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='script_type',
> +            field=models.IntegerField(default=0, choices=[(0, 'N/A'), (2, 'Python'), (3, 'Shell')]),
> +        ),
> +        migrations.AlterField(
> +            model_name='task',
> +            name='sstate_result',
> +            field=models.IntegerField(default=0, choices=[(0, 'Not Applicable'), (1, 'File not in cache'), (2, 'Failed'), (3, 'Succeeded')]),
> +        ),
> +    ]

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-06-10  7:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07 15:37 [PATCH][v2 1/8] toaster: replace viewkeys() -> keys() Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 2/8] toaster: fix migrations Elliot Smith
2016-06-09 17:07   ` Michael Wood
2016-06-10  7:16     ` Bartosh, Eduard
2016-06-07 15:37 ` [PATCH][v2 3/8] toaster: decode response content Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 4/8] toaster: fix incorrect file mode Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 5/8] toaster: fix test_toaster_tables Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 6/8] toaster: fix broken reference to urllib Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 7/8] toaster-tests: fix tests for latest Selenium version Elliot Smith
2016-06-07 15:37 ` [PATCH][v2 8/8] toaster: open image files in binary mode when sending in response Elliot Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.