Merge lp:~samuel-buffet/entertainer/bug_310413 into lp:entertainer
- bug_310413
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Matt Layman | ||||
Approved revision: | 342 | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~samuel-buffet/entertainer/bug_310413 | ||||
Merge into: | lp:entertainer | ||||
To merge this branch: | bzr merge lp:~samuel-buffet/entertainer/bug_310413 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matt Layman | Approve | ||
Paul Hummer | Approve | ||
Review via email: mp+3278@code.launchpad.net |
This proposal supersedes a proposal from 2009-01-08.
Commit message
Description of the change
Samuel Buffet (samuel-buffet) wrote : Posted in a previous version of this proposal | # |
Paul Hummer (rockstar) wrote : Posted in a previous version of this proposal | # |
Samuel-
Great work, code looks good. I have some concerns though that will prevent
this branch from landing. First of all, this code isn't tested anywhere.
Matt and I have been REALLY strict recently about making sure that all code is
properly tested before it lands.
The other thing I'd like you to consider is where this code is used, and how
it handles the case where there is no internet connection. Soon we're going
to have to go on a code fixing spree, handling all the issues where
Entertainer goes out to the net to fetch a resource, and how Entertainer
handles the fact that a network connection might not be available. I
suggest that if this code is accessed by the frontend, we use a gobject
timeout and have "No internet connection available" displayed instead of the
CDDB query. This needs to be fixed before this code can land as well.
vote needs_fixing
Cheers,
--
Paul Hummer
http://
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F
Samuel Buffet (samuel-buffet) wrote : Posted in a previous version of this proposal | # |
Thanks for taking time to review Paul,
> Great work, code looks good. I have some concerns though that will prevent
> this branch from landing. First of all, this code isn't tested anywhere.
> Matt and I have been REALLY strict recently about making sure that all code is
> properly tested before it lands.
Yep, it seems to have no CDDB test. So I'll make one but before can you tell me which test structure is the good one because I've not followed all your modifications recently. Is it the *TestCommon* like in the music-test for instance?
> The other thing I'd like you to consider is where this code is used, and how
> it handles the case where there is no internet connection. Soon we're going
> to have to go on a code fixing spree, handling all the issues where
> Entertainer goes out to the net to fetch a resource, and how Entertainer
> handles the fact that a network connection might not be available. I
> suggest that if this code is accessed by the frontend, we use a gobject
> timeout and have "No internet connection available" displayed instead of the
> CDDB query. This needs to be fixed before this code can land as well.
Yeah, reading the CDDB API doc file I came to the conclusion that it was handled by the CDDB Class but I did not really check. So I'll fix that with a timeout if my CDDB test result is not good.
Thanks again,
Samuel,
Samuel Buffet (samuel-buffet) wrote : Posted in a previous version of this proposal | # |
Paul,
You changed your mind? You don't want this to land in trunk ?
Samuel,
2009/1/31 Paul Hummer <email address hidden>:
> The proposal to merge lp:~samuel-buffet/entertainer/bug_310413 into lp:entertainer has been updated.
>
> Status: Needs review => Rejected
> --
> https:/
> You are subscribed to branch lp:~samuel-buffet/entertainer/bug_310413.
>
Paul Hummer (rockstar) wrote : Posted in a previous version of this proposal | # |
> You changed your mind? You don't want this to land in trunk ?
>
No, it's just that my mind had gone to bed already, but my mind hadn't. I'll
get it fixed. :/
--
Paul Hummer
http://
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F
Samuel Buffet (samuel-buffet) wrote : | # |
I resubmit this one with the past comments :
We now do care of the status of the answer we receive from the CDDB query.
I've also fixed a unicode/charset issue. At least for western occidental accentuated languages.
Samuel,
NOTE:
To test you'll need to find the 2 types of CD.
the one with on dictionnary result (status 200)
the one which gives a list of 3 dictionnaries (status 210 or 211)
(I had difficulties to find a type 200)
_______
Samuel-
Great work, code looks good. I have some concerns though that will prevent
this branch from landing. First of all, this code isn't tested anywhere.
Matt and I have been REALLY strict recently about making sure that all code is
properly tested before it lands.
The other thing I'd like you to consider is where this code is used, and how
it handles the case where there is no internet connection. Soon we're going
to have to go on a code fixing spree, handling all the issues where
Entertainer goes out to the net to fetch a resource, and how Entertainer
handles the fact that a network connection might not be available. I
suggest that if this code is accessed by the frontend, we use a gobject
timeout and have "No internet connection available" displayed instead of the
CDDB query. This needs to be fixed before this code can land as well.
vote needs_fixing
Cheers,
--
Paul Hummer
http://
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F
_______
Thanks for taking time to review Paul,
> Great work, code looks good. I have some concerns though that will prevent
> this branch from landing. First of all, this code isn't tested anywhere.
> Matt and I have been REALLY strict recently about making sure that all code is
> properly tested before it lands.
Yep, it seems to have no CDDB test. So I'll make one but before can you tell me which test structure is the good one because I've not followed all your modifications recently. Is it the *TestCommon* like in the music-test for instance?
> The other thing I'd like you to consider is where this code is used, and how
> it handles the case where there is no internet connection. Soon we're going
> to have to go on a code fixing spree, handling all the issues where
> Entertainer goes out to the net to fetch a resource, and how Entertainer
> handles the fact that a network connection might not be available. I
> suggest that if this code is accessed by the frontend, we use a gobject
> timeout and have "No internet connection available" displayed instead of the
> CDDB query. This needs to be fixed before this code can land as well.
Yeah, reading the CDDB API doc file I came to the conclusion that it was handled by the CDDB Class but I did not really check. So I'll fix that with a timeout if my CDDB test result is not good.
Thanks again,
Samuel,
- 334. By Samuel Buffet
-
3 tests added to MusicLibrary_
test.py to take care of CDDB queries - 335. By Samuel Buffet
-
simplification, the creation of the CompactDisc object is now done during the test setup
Samuel Buffet (samuel-buffet) wrote : | # |
Devs,
So I've tested that part of code without internet connection and there's no freeze.
It seems to have a timeout in CDDB queries which create an exception so the result is we have after no more than 1 second a "no cd" message.
I've added 3 tests to check that CDDB queries return the results we expect.
Album name, Artist name and Tracks names are checked for the best Album ever "The Joshua Tree" ;)
New diff bellow :
Samuel.
=== modified file 'entertainerlib
--- entertainerlib/
+++ entertainerlib/
@@ -601,65 +601,49 @@
- # FIXME: query_info contains code that we could use instead of TRY
- # EXCEPT
- #See CDDB documentation for more information.
+ #See CDDB documentation for more information
#http://
-
- if query_info is not None:
- # query_info variable's type depends on how many matches we get.
- # If we get just one match then it's a map and if we get more
- # than one it's a list.
- try:
- title = query_info['title']
- self.artist = title[:
- self.album = title[title.index(' / ') + 3:]
-
- # Get track titles
- (read_status, read_info) = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
- except:
- query = query_info[0]
- self.artist = query['
- self.album = query['
-
- # Get track titles
- (read_status, read_info) = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- ...
- 336. By Samuel Buffet
-
merged vs trunk
- 337. By Samuel Buffet
-
merged vs trunk
- 338. By Samuel Buffet
-
merged vs trunk 343 and conflicts resolution
- 339. By Samuel Buffet
-
new CompactDisc tests added to test_music.py
Samuel Buffet (samuel-buffet) wrote : | # |
Devs,
So I've merged this one and reworked the new tests to comply with new test format.
Find bellow the new diff :
Samuel,
=== modified file 'entertainerlib
--- entertainerlib/
+++ entertainerlib/
@@ -597,67 +597,51 @@
"""
- query_info = CDDB.query(
+ (query_status, query_info) = CDDB.query(disc_id)
- # FIXME: query_info contains code that we could use instead of TRY
- # EXCEPT
- #See CDDB documentation for more information.
+ #See CDDB documentation for more information
#http://
-
- if query_info is not None:
- # query_info variable's type depends on how many matches we get.
- # If we get just one match then it's a map and if we get more
- # than one it's a list.
- try:
- title = query_info['title']
- self.artist = title[:
- self.album = title[title.index(' / ') + 3:]
-
- # Get track titles
- read_info = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
- except:
- query = query_info[0]
- self.artist = query['
- self.album = query['
-
- # Get track titles
- read_info = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
+ # quer...
- 340. By Samuel Buffet
-
merged vs trunk 344
- 341. By Samuel Buffet
-
merged vs trunk 349
Matt Layman (mblayman) wrote : | # |
"Devs,
So I've merged this one and reworked the new tests to comply with new test format.
Find bellow the new diff :
Samuel,
=== modified file 'entertainerlib
--- entertainerlib/
+++ entertainerlib/
@@ -597,67 +597,51 @@
"""
- query_info = CDDB.query(
+ (query_status, query_info) = CDDB.query(disc_id)
- # FIXME: query_info contains code that we could use instead of TRY
- # EXCEPT
- #See CDDB documentation for more information.
+ #See CDDB documentation for more information
#http://
-
- if query_info is not None:
- # query_info variable's type depends on how many matches we get.
- # If we get just one match then it's a map and if we get more
- # than one it's a list.
- try:
- title = query_info['title']
- self.artist = title[:
- self.album = title[title.index(' / ') + 3:]
-
- # Get track titles
- read_info = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
- except:
- query = query_info[0]
- self.artist = query['
- self.album = query['
-
- # Get track titles
- read_info = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
+ # que...
Samuel Buffet (samuel-buffet) wrote : | # |
Matt Hi,
Thanks to take a look to this one.
>No Internet means no passing tests
>from what I can tell.
...
>The question we need to answer is "How do we mock out CDDB so it doesn't actually talk to the
>Internet?
...
>... but testing with the assumption of an Internet connection should be a no-no.
Matt, I think that in that particular case it really makes sense to fail tests without internet connection because what we want to test comes from the internet.
I mean, we precisely want to test the process of getting informations from CDDB's database. So in case of change in the CDDB python module or on the CDDB database API itself we'll be informed by our tests. As long as we get correct informations for a CD then the rest is more a matter of *screen testing*.
If we *mock* everything coming from the internet then we'll be blind, and we won't be able to fix things (but yes we'll pass all tests).
An improvement could be to be able to do 2 kind of tests with and without internet connection because we are expecting different behaviours of Entertainer then. But I don't know if and how we can do that.
What do you think Matt?
Samuel,
Paul Hummer (rockstar) wrote : | # |
> An improvement could be to be able to do 2 kind of tests with and without
> internet connection because we are expecting different behaviours of
> Entertainer then. But I don't know if and how we can do that.
I think this is the best case. In fact, when we test WITH a connection to the
internet, we're testing that the API is still the same as we expect it to be,
and so we should test every property in the return values that we use
anywhere.
A good case in point is the weather tests. They started failing, and on
further inspection, it became apparent that Google had changed the return
values in certain cases.
Mocking the socket connection is currently not something on the high priority
list. I know that Matt is working on some screen testing code. This will
help when we add gobject timeouts to all external requests, and then mock out
a stub timeout so that we know that Entertainer will properly time out on the
client and just show no data.
--
Paul Hummer
http://
1024/862FF08F C921 E962 58F8 5547 6723 0E8C 1C4D 8AC5 862F F08F
Paul Hummer (rockstar) wrote : | # |
Samuel-
Great branch. The only thing that needs to change is that the English word
"information" can be plural as well, so there is no word "informations". Other
than that, I'm happy with the changes.
Paul
Matt Layman (mblayman) wrote : | # |
I'm glad we at least had some discussion about the validity of writing a test that actually connects to the Internet. Based on the conversation, I can see the benefit to that type of testing so I'll happily approve too.
Thanks for entertaining the discussion topic.
- 342. By Samuel Buffet
-
_get_informatio
ns_from_ result_ element => _get_informatio n_from_ result_ element
Samuel Buffet (samuel-buffet) wrote : | # |
"Samuel-
Great branch. The only thing that needs to change is that the English word
"information" can be plural as well, so there is no word "informations". Other
than that, I'm happy with the changes.
Paul
"
Thanks for this *information* (I didn't know that) ;)
I've fixed it.
Cheers,
Samuel
Samuel Buffet (samuel-buffet) wrote : | # |
"I'm glad we at least had some discussion about the validity of writing a test that actually connects to the Internet. Based on the conversation, I can see the benefit to that type of testing so I'll happily approve too.
Thanks for entertaining the discussion topic."
Yes Matt, exchanging experiences is one of the best things we can do.
I've already learned a lot of things discussing with you and Paul and I enjoy that very much.
Cheers,
Samuel
Matt Layman (mblayman) wrote : | # |
Commit Message: CD information fetching is improved. (Samuel Buffet)
We now do care of the status of the answer we receive from the CDDB query.
I've also fixed a unicode/charset issue. At least for western occidental accentuated languages.
Samuel,
NOTE:
To test you'll need to find the 2 types of CD.
the one with on dictionnary result (status 200)
the one which gives a list of 3 dictionnaries (status 210 or 211)
(I had difficulties to find a type 200)
the diff: /frontend/ medialibrary/ music.py' frontend/ medialibrary/ music.py 2008-08-05 07:42:50 +0000 frontend/ medialibrary/ music.py 2009-01-08 21:46:01 +0000
=== modified file 'entertainerlib
--- entertainerlib/
+++ entertainerlib/
@@ -601,65 +601,49 @@
- # FIXME: query_info contains code that we could use instead of TRY cddb-py. sourceforge. net/CDDB/ README title.index( ' / ')] query_info[ 'category' ], 'disc_id' ]) len(disc_ id) - 1] - cumulative_length append( CompactDiscTrac k(i + 1, track_title, title'] [:query[ 'title' ].index( ' / ')] title'] [query[ 'title' ].index( ' / ') + 3:] query_info[ 0]['category' ], 0]['disc_ id']) len(disc_ id) - 1] - cumulative_length
- # EXCEPT
- #See CDDB documentation for more information.
+ #See CDDB documentation for more information
#http://
-
- if query_info is not None:
- # query_info variable's type depends on how many matches we get.
- # If we get just one match then it's a map and if we get more
- # than one it's a list.
- try:
- title = query_info['title']
- self.artist = title[:
- self.album = title[title.index(' / ') + 3:]
-
- # Get track titles
- (read_status, read_info) = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumulative_length + length
-
- track_title = read_info['TTITLE' + str(i)]
- self.tracks.
- length))
- except:
- query = query_info[0]
- self.artist = query['
- self.album = query['
-
- # Get track titles
- (read_status, read_info) = CDDB.read(
- query_info[
- cumulative_length = 0
- for i in range(disc_id[1]):
- if i + 4 == len(disc_id):
- # We must calculate last track length different way
- length = disc_id[
- else:
- # Calculate track length in seconds
- length = (disc_id[i+3] - disc_id[i+2]) / 75
- cumulative_length = cumu...