#99 Upgrade to Django 1.8

Fusionné
jocelyn a fusionné 11 commits à partir de FFDN/django-1.8 vers FFDN/master il y a 8 ans
jocelyn a commenté il y a 8 ans

Here is it! Finaly fix long due #13

I'd love some feedback before merging, especially testing:

  • from folks using LDAP (which is not my case, nor the case of FAImaison)
  • from folks using PostgreSQL (I mainly use sqlite for development)

Note that I did the effort (on master branch, before this PR to fix the test suite) so that anyone can get the minimal test suite.

If you test with postgresql, be sure to use the correct settings module, as coin.settings_test hardcodes sqlite use (and does not takes into account settings_local.py)

Testing guidelines

  • Update dependencies within your virtualenv:

$ pip install -r requirements.txt

  • Migrate

$ ./manage.py migrate

  • Run unit tests
  • Test by hand (./manage.py runserver, run some views, do things…), the coin unit test suite is far away from being complete, manual test is required

After this gets merged

Thanks

To @zorun for the useful comments in #13… Even if I found it a bit late, after having done the same researches on my side :-/.

To testers, by advance :-)

Here is it! Finaly fix long due #13 I'd love some feedback before merging, especially testing: - **from folks using LDAP** (which is not my case, nor the case of FAImaison) - **from folks using PostgreSQL** (I mainly use sqlite for development) Note that I did the effort (on master branch, before this PR to fix the test suite) so that anyone can get the minimal test suite. **If you test with postgresql**, be sure to use the correct settings module, as `coin.settings_test` hardcodes sqlite use (and does not takes into account `settings_local.py`) ## Testing guidelines - Update dependencies within your virtualenv: $ pip install -r requirements.txt - Migrate $ ./manage.py migrate - [Run unit tests](https://code.ffdn.org/FFDN/coin#running-tests) - Test by hand (`./manage.py runserver`, run some views, do things…), the coin unit test suite is far away from being complete, manual test is required ## After this gets merged - we still have technical debt: Django is at 1.10 nowadays - we are back on a [maintained and Long-Term-Support version](https://www.djangoproject.com/download/#supported-versions) ## Thanks To @zorun for the useful comments in #13… Even if I found it a bit late, after having done the same researches on my side :-/. To testers, by advance :-)
capslock a commenté il y a 8 ans
Collaborateur

I think there is an error in requirements.txt ; did you meant :

Django>=1.8.17,<1.9

instead of current value :

Django>=1.8.17,1.9

I think there is an error in requirements.txt ; did you meant : Django>=1.8.17,<1.9 instead of current value : Django>=1.8.17,1.9
capslock a commenté il y a 8 ans
Collaborateur

An error occurs when a member goes to /members/contact/ ;

Valeur entrée dans le champ ISP infos > chat room url :

http://#faimaison@irc.geeknode.org

An error occurs when a member goes to /members/contact/ ; Valeur entrée dans le champ ISP infos > chat room url : http://#faimaison@irc.geeknode.org
capslock a commenté il y a 8 ans
Collaborateur

If chat url is removed from ISP infos ; the error changes :

If chat url is removed from ISP infos ; the error changes :
capslock a commenté il y a 8 ans
Collaborateur

While using master version ; I added a new IP address pool as :

name : lolcal default subnet size : 30 network : 192.168.0.0/24

and it was accepted. When I do the same with changes from this PR ; I get errors (cf screenshot)

To be noted tests fails too :


............E

ERROR: setUpClass (vpn.tests.VPNTestCase)

Traceback (most recent call last): File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/test/testcases.py", line 956, in setUpClass

'database': db_name,

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/init.py", line 120, in call_command

return command.execute(*args, **defaults)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute

output = self.handle(*args, **options)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 60, in handle

self.loaddata(fixture_labels)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 100, in loaddata

self.load_label(fixture_label)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 157, in load_label

obj.save(using=self.using)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 173, in save

models.Model.save_base(self.object, using=using, raw=True)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 762, in save_base

updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 827, in _save_table

forced_update)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 877, in _do_update

return filtered._update(values) > 0

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/query.py", line 580, in _update

return query.get_compiler(self.db).execute_sql(CURSOR)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1062, in execute_sql

cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql

cursor.execute(sql, params)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute

return self.cursor.execute(sql, params)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/utils.py", line 98, in exit

six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute

return self.cursor.execute(sql, params)

File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute

return Database.Cursor.execute(self, query, params)

InterfaceError: Problem installing fixture '/home/legeox/Documents/FAImaison-repos/coin/coin/resources/fixtures/example_pools.json': Error binding parameter 2 - probably unsupported type.


Ran 29 tests in 3.364s

FAILED (errors=1, skipped=5) Destroying test database for alias 'default'... DJANGO_SETTINGS_MODULE=coin.settings_test ./manage.py test 10,57s user 0,15s system 99% cpu 10,743 total


While using master version ; I added a new IP address pool as : name : lolcal default subnet size : 30 network : 192.168.0.0/24 and it was accepted. When I do the same with changes from this PR ; I get errors (cf screenshot) To be noted tests fails too : ********************************************************************* ............E ====================================================================== ERROR: setUpClass (vpn.tests.VPNTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/test/testcases.py", line 956, in setUpClass 'database': db_name, File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command return command.execute(*args, **defaults) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(*args, **options) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 60, in handle self.loaddata(fixture_labels) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 100, in loaddata self.load_label(fixture_label) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 157, in load_label obj.save(using=self.using) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 173, in save models.Model.save_base(self.object, using=using, raw=True) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 762, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 827, in _save_table forced_update) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/base.py", line 877, in _do_update return filtered._update(values) > 0 File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/query.py", line 580, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1062, in execute_sql cursor = super(SQLUpdateCompiler, self).execute_sql(result_type) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql cursor.execute(sql, params) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/legeox/Documents/FAImaison-repos/coin/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute return Database.Cursor.execute(self, query, params) InterfaceError: Problem installing fixture '/home/legeox/Documents/FAImaison-repos/coin/coin/resources/fixtures/example_pools.json': Error binding parameter 2 - probably unsupported type. ---------------------------------------------------------------------- Ran 29 tests in 3.364s FAILED (errors=1, skipped=5) Destroying test database for alias 'default'... DJANGO_SETTINGS_MODULE=coin.settings_test ./manage.py test 10,57s user 0,15s system 99% cpu 10,743 total ************************************************
capslock a commenté il y a 8 ans
Collaborateur

When adding a new configuration (from /admin/configuration/configuration/)

I get following error ;

Another strange behaviour is that Configuration list says I have 1 configuration but displayed list is empty (it was already the case before using "Add configuration" button) :

When adding a new configuration (from /admin/configuration/configuration/) I get following error ; Another strange behaviour is that Configuration list says I have 1 configuration but displayed list is empty (it was already the case before using "Add configuration" button) :
jocelyn a commenté il y a 8 ans
Propriétaire

Thanks for huge feedback !

I think there is an error in requirements.txt […]

Fixed

An error occurs when a member goes to /members/contact/ ; Valeur entrée dans le champ ISP infos > chat room url : http://#faimaison@irc.geeknode.org

Fixed in 18135781db

Still have to work on the other points :-)

Thanks for huge feedback ! > I think there is an error in requirements.txt […] Fixed > An error occurs when a member goes to /members/contact/ ; > Valeur entrée dans le champ ISP infos > chat room url : > http://#faimaison@irc.geeknode.org Fixed in 18135781db Still have to work on the other points :-)
jocelyn a commenté il y a 8 ans
Propriétaire

InterfaceError: Problem installing fixture '/home/legeox/Documents/FAImaison-repos/coin/coin/resources/fixtures/example_pools.json': Error binding parameter 2 - probably unsupported type.

@capslock cannot reproduce :-/

> InterfaceError: Problem installing fixture '/home/legeox/Documents/FAImaison-repos/coin/coin/resources/fixtures/example_pools.json': Error binding parameter 2 - probably unsupported type. @capslock cannot reproduce :-/
jocelyn a commenté il y a 8 ans
Propriétaire

When adding a new configuration (from /admin/configuration/configuration/) I get following error ;

It's because you have no Offer object with a configuration type (I think it's not related to the current PR). I agree Interface should handle that better.

Another strange behaviour is that Configuration list says I have 1 configuration but displayed list is empty (it was already the case before using "Add configuration"button) :

Cannot reproduce (do you think it's related to the current PR ?)

> When adding a new configuration (from /admin/configuration/configuration/) > I get following error ; It's because you have no Offer object with a configuration type (I think it's not related to the current PR). I agree Interface should handle that better. > Another strange behaviour is that Configuration list says I have 1 configuration but displayed list is empty (it was already the case before using "Add configuration"button) : Cannot reproduce (do you think it's related to the current PR ?)
jocelyn a commenté il y a 8 ans
Propriétaire

While using master version ; I added a new IP address pool as : name : lolcal default subnet size : 30 network : 192.168.0.0/24 and it was accepted. When I do the same with changes from this PR ; I get errors (cf screenshot)

To be noted tests fails too […]

So, IP resources handling with django-netfields handling was something I did not test previously (I was using sqlite only).

I took the time to test also with postgres and found the errors you were reporting and fixed them (see related commits).

For the story, I literally spent hours in debugger on one failing test… to find out that netfields was missing in INSTALLED_APPS (I suppose it was not required in previous versions) >_<.

There are 2 unit tests I did not fix, because they were already broken before this PR, see #103

@capslock I would be happy to get a final feedback from you before merging, if you don't have time, tell me, and I'll merge as-is.

> While using master version ; I added a new IP address pool as : > name : lolcal default subnet size : 30 network : 192.168.0.0/24 > and it was accepted. When I do the same with changes from this PR ; I get errors (cf screenshot) > To be noted tests fails too […] So, IP resources handling with *django-netfields* handling was something I did not test previously (I was using sqlite only). I took the time to test also with postgres and found the errors you were reporting and fixed them (see related commits). For the story, I literally spent hours in debugger on one failing test… to find out that `netfields` was missing in `INSTALLED_APPS` (I suppose it was not required in previous versions) >_<. There are 2 unit tests I did not fix, because they were already broken before this PR, see #103 @capslock I would be happy to get a final feedback from you before merging, if you don't have time, tell me, and I'll merge as-is.
daimrod a commenté il y a 8 ans
Collaborateur

DJANGO_SETTINGS_MODULE=coin.settings_test ./manage.py test

Ran 39 tests in 12.416s

OK (skipped=11)
Destroying test database for alias 'default'...

J'ai fait quelques tests de création/suppression de membres/factures/abonnements et tout fonctionnait.

OK pour moi

DJANGO_SETTINGS_MODULE=coin.settings_test ./manage.py test Ran 39 tests in 12.416s OK (skipped=11) Destroying test database for alias 'default'... J'ai fait quelques tests de création/suppression de membres/factures/abonnements et tout fonctionnait. OK pour moi
Cette Pull Request a été fusionnée avec succès !
Connectez-vous pour rejoindre cette conversation.
Aucun jalon
Pas d'assignataire
3 Participants
Chargement…
Annuler
Enregistrer
Il n'existe pas encore de contenu.