These are chat archives for translate/dev

7th
Sep 2017
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 08:34
ping @phlax
phlax
@phlax
Sep 07 2017 08:34
@jjmcarrascosa pong
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 08:34
Hi, phlax! I'm back. I've restored everything and decided to make changes not in the working server :) So I have pull our branch and installed the dev requirements
phlax
@phlax
Sep 07 2017 08:35
cool, im about so can help further
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 08:35
but as yesterday, I have a problem with inconsistencies with the translate toolkit versions. When installing dev req, it installs rtanslate-toolkit 2.2.4, but then the pytest_pootle checks I have installed 2.2.5 and fails.
"Plugin %r could not be loaded: %s!" % (ep.name, e))
_pytest.vendored_packages.pluggy.PluginValidationError: Plugin 'pytest_pootle' could not be loaded: (translate-toolkit 2.2.5 (/home/jjmartinez/src/pootle/env/lib/python2.7/site-packages), Requirement.parse('translate-toolkit==2.2.4'))!
phlax
@phlax
Sep 07 2017 08:38
not sure, i get that from time to time
but pip install -e . in the pootle dir fixes
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 08:38
ah great
yes, fixed it
great! i can run the tests now
phlax
@phlax
Sep 07 2017 08:39
cool!
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 08:39
so let me check all the comments you wrote yesterday :)
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:14
is that xfail something I should worry about?
======================================================= test session starts =======================================================
platform linux2 -- Python 2.7.12, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 -- /home/jjmartinez/src/pootle/env/bin/python2
cachedir: .cache
rootdir: /home/jjmartinez/src/pootle_dev/pootle, inifile: setup.cfg
plugins: cov-2.5.1, catchlog-1.2.2, django-3.1.2, django-assets-0.12, Pootle-2.9.0b2
collected 2551 items                                                                                                               

tests/commands/create_project.py::test_cmd_create_project_defaults PASSED
tests/commands/create_project.py::test_cmd_create_project_title PASSED
tests/commands/create_project.py::test_cmd_create_project_checkstyle xfail

====================================================== 2548 tests deselected ======================================================
====================================== 2 passed, 2548 deselected, 1 xfailed in 8.03 seconds =======================================
it's shown in green though
@phlax
Leandro Regueiro
@unho
Sep 07 2017 09:24
@jjmcarrascosa The xfail tests are the ones you have to make them xpass.
@jjmcarrascosa In other words xfail says that the test failed, but that it is marked as expected to fail, thus why it is green.
phlax
@phlax
Sep 07 2017 09:25
if you see the comment on the test @jjmcarrascosa it says the reason its xfailing
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:25
@unho ah I see
yes, you are right I remember that
thank you
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:32
Checkstyle is the same as the "quality" right?
phlax
@phlax
Sep 07 2017 09:32
lmc...
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:33
in models.py I see something like...
    checkstyle = models.CharField(
        max_length=50,
        default='standard',
        null=False,
        validators=[validate_project_checker],
        verbose_name=_('Quality Checks'))
it seems is the same?
phlax
@phlax
Sep 07 2017 09:33
yep
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:39
ok, done
I'm going to commit
ls
phlax
@phlax
Sep 07 2017 09:40
cool, ill check again, and start adding some more tests
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 09:48
done
can you check?
phlax
@phlax
Sep 07 2017 09:49
yep, checking...
phlax
@phlax
Sep 07 2017 10:04
k, @jjmcarrascosa ive pushed back to your repo, with some test changes
can you rebase your PR now against master
git fetch upstream
git rebase upstream/master
you will need to that after you have gotten the latest version
master has some updates that mean we can uncomment out the the fs config tests
phlax
@phlax
Sep 07 2017 10:43
@jjmcarrascosa ping me when you have rebased and pushed and we can add some more stuff
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 10:43
@phlax , yes, I'm doing it right now
phlax
@phlax
Sep 07 2017 10:43
cool
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 10:51
ok I have merged and rebased using your commands
phlax
@phlax
Sep 07 2017 10:51
cool can you push back
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 10:55
Done. Not sure I've done it right, can you check?
phlax
@phlax
Sep 07 2017 10:55
yep
seems like its separated out the commits - did you use the git merge command ?
or just rebase ?
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 10:57
just rebase
phlax
@phlax
Sep 07 2017 10:57
wierd - not sure why its gone like that
i have a local branch - ill push back with that...
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 10:58
ok, sorry
phlax
@phlax
Sep 07 2017 11:03
np, i have had similar happen before - not sure what cause is
cleaned up
so next thing @jjmcarrascosa
re checkstyle
i added a test to ensure that if you set a non-existent checkstyle it wouldnt save
but i think slightly better approach would be to add choices to the command args
and the choices can be got like...
from pootle_project.models import PROJECT_CHECKERS
choices = PROJECT_CHECKERS.keys()
it will most likely break the test as i think it will raise CommandError rather than ValidationError
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:14
E   NameError: global name 'ValidationError' is not defined
this is what the test says
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:16
sure. Fixed.
E CommandError: Error: argument --checkstyle: invalid choice: u'DOESNOTEXIST' (choose from 'kde', 'mozilla', 'standard', 'openoffice', 'l20n', 'wx', 'gnome', 'drupal', 'terminology', 'creativecommons', 'libreoffice', 'reduced', 'minimal')
E   CommandError: Error: argument --checkstyle: invalid choice: u'DOESNOTEXIST' (choose from 'kde', 'mozilla', 'standard', 'openoffice', 'l20n', 'wx', 'gnome', 'drupal', 'terminology', 'creativecommons', 'libreoffice', 'reduced', 'minimal')
phlax
@phlax
Sep 07 2017 11:16
great!
so change the pytest.raises to CommandError
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:17
ok
and I need to include the import
phlax
@phlax
Sep 07 2017 11:18
hmm
if you are missing that import im wondering what else is missing
try rebasing again against the github branch
or do git log to check that there are not extra commits that remove it
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:19
probably i've overwritten something
let me check
I will try to rebase again
git fetch upstream
git rebase upstream/master
right?
phlax
@phlax
Sep 07 2017 11:22
yep, well, i do it slightly differently...
git checkout master
git fetch upstream
git rebase upstream/master
git checkout MYBRANCH
git rebase master
it makes it easier working with multiple branches
(might just be my ocd tho 8/)
if all else fails @jjmcarrascosa
do
hmm
wait @jjmcarrascosa just realised
you need to rebase against origin not upstream
so more like...
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:26
XD
ok
phlax
@phlax
Sep 07 2017 11:27
git fetch origin
git rebase origin/fork-create-project
(pull -f might also work but you would loose any local changes)
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:30
Ok, rebased
let me now push the changes
oh no
phlax
@phlax
Sep 07 2017 11:30
so, at this point i would check the git log
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:30
I had an error
phlax
@phlax
Sep 07 2017 11:31
check the files, and probs run the tests (maybe flake8 on the relevant files too)
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:31
yes
phlax
@phlax
Sep 07 2017 11:31
to make sure you have what you think you have
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:31
ok, all passed
now I'm going to add the choices, because I pulled everything and overwrote the local changes
phlax
@phlax
Sep 07 2017 11:32
cool
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:34
E   CommandError: Error: argument --checkstyle: invalid choice: u'DOESNOTEXIST' (choose from 'kde', 'mozilla', 'standard', 'openoffice', 'l20n', 'wx', 'gnome', 'drupal', 'terminology', 'creativecommons', 'libreoffice', 'reduced', 'minimal')
so
now changing ValidError to CommandError
ValidationError to CommandError
right?
but I still don't see any CommandError import, don't we need to add an import?
phlax
@phlax
Sep 07 2017 11:36
one mo
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:36
again the same we had before :)
phlax
@phlax
Sep 07 2017 11:36
yep, we need to import CommandError
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:36
That's what I was telling you before, I had it right
let me include it
phlax
@phlax
Sep 07 2017 11:37
E   NameError: global name 'ValidationError' is not defined
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:37
Befooooore that, after re-rebasing :)
ok
and I need to include the import
uhmmm
can't find from django.core.exceptions import CommandError
phlax
@phlax
Sep 07 2017 11:38
try...
git grep CommandError | grep import
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:39
got it
thanks
all passed
phlax
@phlax
Sep 07 2017 11:49
great
so next thing @jjmcarrascosa - can you change filetype to filetypes here https://github.com/translate/pootle/pull/6633/files#diff-c8415804410419c7a8c9daf15b71c48cR37
because you can have multiple filetypes in a project
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:50
sure!
phlax
@phlax
Sep 07 2017 11:51
iirc you will want to change action="store" to action="append"
might need to check argparse docs about that
or check for other examples in codebase
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 11:52
ok
phlax
@phlax
Sep 07 2017 11:52
we probs also want to have choices for this option
the choices will be...
from pootle.core.delegate import formats
formats.get().keys()
Jose J. Martinez
@jjmcarrascosa
Sep 07 2017 12:11
ok I have to go, i'll continue with all of this tomorrow
thank you SO MUCH @phlax
phlax
@phlax
Sep 07 2017 12:12
cool, we are getting there, laters
np