Bug 97361 - Make unittests more pythonic
Summary: Make unittests more pythonic
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0 target:5.4.0 target:6.1....
Keywords: difficultyBeginner, easyHack, skillPython, topicQA
Depends on:
Blocks:
 
Reported: 2016-01-25 15:07 UTC by Björn Michaelsen
Modified: 2019-03-18 08:40 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2016-01-25 15:07:31 UTC
Since:

 http://cgit.freedesktop.org/libreoffice/core/commit/?id=af8143bc40cf2cfbc12e77c9bb7de01b655f7b30

one can write code that looks a lot more native and less cumbersome in Python/PyUNO. Quite a few of our Python unittests where translated from old Java tests and still contain boilerplate that is superficial in Python. This EasyHack is to look at the existing Python tests and make them more readable by using the added pythonic features.

code pointer:

 http://cgit.freedesktop.org/libreoffice/core/commit/?id=af8143bc40cf2cfbc12e77c9bb7de01b655f7b30
 <module>/qa/python/<foo>.py
 https://wiki.documentfoundation.org/Development/Python_Unit_Tests
Comment 1 Dhruv Khattar 2016-01-28 05:20:03 UTC
Hey, I would like to work on this issue.
Can you tell me what to do?
Comment 2 jani 2016-01-28 08:12:12 UTC
(In reply to Dhruv Khattar from comment #1)
> Hey, I would like to work on this issue.
> Can you tell me what to do?

May I suggest you only work on one bug, and please read the comments. Comment 1 describes very well what needs to be done.
Comment 3 Gaurav Dhingra 2016-02-10 18:29:39 UTC
I would like to a work on this, if no one else is working. I am new to the community.
Comment 4 jani 2016-02-10 19:30:34 UTC
This is one of the generic task, where multiple people work in parallel.

We have made a step by step guide to help you get started:
https://wiki.documentfoundation.org/Development/GetInvolved/DeveloperStepByStep

LibreOffice is a very big program and getting it built, setting up gerrit, and getting the first patch right can be a bit challenging, therefore do not hesitate to email me if you want help.

However the unittest are very easy to manage if you follow the step-by-step guide.
Comment 5 Björn Michaelsen 2016-02-10 20:02:50 UTC
Matthew Francis gave a great talk in Aarhus on what is possible with the new PyUNO stuff. Watch it here:
 
 https://www.youtube.com/watch?v=jS1nnSqGbZM
Comment 6 jani 2016-02-12 20:38:54 UTC
This is a generic bug, where multiple people can work on each their unittest, therefore you should not assign it to yourself.

have a look at
https://wiki.documentfoundation.org/Development/GetInvolved

Looking forward to see your patches.
Comment 7 Robinson Tryon (qubit) 2016-02-18 14:52:41 UTC Comment hidden (obsolete)
Comment 8 Commit Notification 2016-03-30 06:59:59 UTC
slideon committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c19219d5f49b305d31ad251bc87a87b0109c2402

tdf#97361 Refactor load_save_test

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2016-04-04 06:42:42 UTC
slideon committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9338e4f5b1ffcba2d5b0bd8960dd8795d8909ff1

tdf#97361 Refactor dbaccess test again

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2016-04-05 10:35:38 UTC
slideon committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d513cd3bf635af857624b8c8e693f82f3073e0b4

tdf#97361 Fix check_table and remove = None assignments

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 jani 2016-04-26 09:01:09 UTC
Not my scope
Comment 12 amdomanska 2016-09-24 18:11:55 UTC
I would like to work on it. I can see some patches were already developed for that one. Is there still some work to be done? It's my first bug in libreoffice, I'm going to need some guidance probably. Is that good choice? Any suggestions?
Comment 13 Commit Notification 2016-12-04 11:43:14 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=48120d6ce597472933fa7a8a292ce8d0f1fbe1f9

tdf#97361 remove = None assignments in check_fields

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2016-12-05 11:30:58 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=25cc8979c5e6238bb76c9d751f3fa3433f48542c

tdf#97361 remove = None assignments in sfx2 python unit tests

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2016-12-12 17:26:04 UTC
n5xgdh committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9d67a5872ef7e4b38eb8158046e149a59d6af4f3

tdf#97361: Changed naming convention to Python type, object factories implemented

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2016-12-13 11:57:19 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2fa2e149e4829eb653da7972970e1e3e5ba9983d

tdf#97361 Fixed check_flies.py

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2016-12-13 12:00:08 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7724c6136a5d2e7666b4e801fc6f5df83e18a961

tdf#97361 Fixed check_cross_references.py

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2016-12-20 23:35:38 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=027a41959cc722fb9e3e7e2375eac9a3703d4799

tdf#97361: Changed naming in sfx2 python tests

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2016-12-20 23:37:03 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9cfb2f2f03b5ec086487fd483298466db0b09010

tdf#97361: Changed naming in var_fields and load_save_test

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2017-01-03 00:03:14 UTC
Justn Lavoie committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6cea397a95dab91ebf37f25e443393c22da065f7

tdf#97361 Use join() for string concatenation

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2017-01-03 17:14:21 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c2e69df36464437d70c4396a4bc5932e6a97a0ff

tdf#97361: Changed method calls in check_flies

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2017-01-03 17:18:00 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ceab0bab9275394e8ac20e32a1d7828b4eb1f6ac

tdf#97361: Changed naming in check_fields and check_table

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2017-01-03 17:20:31 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=564bbaba573b565dfd7180ef20054ebf0297fe9b

tdf#97361: Changed method calls in check_indexed_property_values

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2017-01-09 08:19:29 UTC
kerem committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9f18ee7fd912a6ba600985c5fcbe1e8672dfa993

tdf#97361: Changed method calls in sfx2 python tests

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Xisco Faulí 2017-11-23 03:29:06 UTC Comment hidden (obsolete)
Comment 26 Xisco Faulí 2017-12-24 03:27:20 UTC Comment hidden (obsolete)
Comment 27 Furkan Ahmet KARA 2017-12-24 06:28:21 UTC
I am sorry I couldn't find time to solve this bug but but I can't leave the assignment.How can I leave bug assignment?
Comment 28 Commit Notification 2018-01-16 14:41:11 UTC
Saurav Chirania committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ada02c556531e9e5f28a159223fc7e2b36a7a84d

tdf#97361 Tests in sw should be more pythonic

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Commit Notification 2018-02-12 22:22:41 UTC
Saurav Chirania committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4469c1d4061e8cb463469e60e5d87af5f9bf9636

tdf#97361 Tests in sw should be more pythonic

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 30 Commit Notification 2018-02-26 18:41:02 UTC
Saurav Chirania committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8e1bb35eeb332d7cb8e4aafb47b57a0ffd7de044

Revert "tdf#97361 Tests in sw should be more pythonic"

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 31 Hamish McIntyre-Bhatty 2018-10-09 20:17:50 UTC
Just a quick comment to let anyone interested know that I'm about to start work on this. I'm new here, so I might need some help, but the documentation seems good, so I reckon I'll be alright.
Comment 32 Hamish McIntyre-Bhatty 2018-10-10 14:30:05 UTC
Note, I found a unit test I was going to work on - /sw/qa/python/load_save_test.py. However, I found that there is no entry for it in PythonTest_sw_python.mk and that it doesn't work (results in a segfault) when added.

I'll move on to other files now, but I though this should be noted.
Comment 33 Commit Notification 2018-11-12 06:01:21 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/6bfef5f9fdb0977af10ad32db712968825e31f34%5E%21

tdf#97361 Make var_fields more pythonic.

It will be available in 6.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 34 Commit Notification 2018-11-12 06:01:29 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/f3b743a453002c78eacd0482c26017b75964c989%5E%21

tdf#97361 Make check_table.py more pythonic

It will be available in 6.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 35 Commit Notification 2018-11-12 06:01:35 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/6e9b4cf30d9ab8d77d14813ab35f32fb63d3f7e8%5E%21

tdf#97361 Make check_bookmarks.py more pythonic

It will be available in 6.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 36 Hamish McIntyre-Bhatty 2019-01-11 20:37:23 UTC
Note for xtext.py:

I was just working on xtext.py as part of this bug, and I just found a note, showing that removing annotations that have already been removed doesn't result in an exception. According to the unit test, it should.

Should I report this as a separate issue? I don't really know what the annotations are for, or what they do, but with a bit of guidance I am happy to try to fix this issue.

Hamish
Comment 37 Commit Notification 2019-02-12 07:09:24 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/b0b23543449a3666df6e48c561672432af9d6948%5E%21

tdf#97361 Make xtextcontent.py more pythonic

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 38 Commit Notification 2019-02-13 09:16:15 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/19b5607329d3b9c12aa743b5480e9dec1b74ceea%5E%21

tdf#97361 Make xtext.py more pythonic

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 39 shubhamgoyal 2019-02-14 14:15:24 UTC Comment hidden (obsolete)
Comment 40 shubham 2019-02-14 15:52:16 UTC Comment hidden (obsolete)
Comment 41 Commit Notification 2019-03-18 08:40:16 UTC
Hamish McIntyre-Bhatty committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/f4a1dfe2ea2750467f2cc8cc50a14c656beda6ec%5E%21

tdf#97361 make xscriptprovider.py more pythonic

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.