-
Notifications
You must be signed in to change notification settings - Fork 80
Issue 835 #845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 835 #845
Conversation
@squirrelo, there are legitimate flake8 errors in this build. |
Not any more. |
💥 💥 |
@@ -427,6 +428,26 @@ def test_build_files_raises_value_error(self): | |||
with self.assertRaises(ValueError): | |||
self.analysis.build_files(-10) | |||
|
|||
def test_add_file(self): | |||
fp = join(get_mountpoint('analysis')[0][1], 'testfile.txt') | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly: if you can write to the file path you add it to the analysis and regardless of the result of these two lines you check if it exists and if it exists you remove it? Should that fp be removed in the teardown method of the test class? So we can guarantee that it is removed, the finally block here is kinda confusing.
This PR looks ok but I'm not super familiar with this codebase so it would be nice if someone else could review it in depth. |
Yes, the finally makes it so the test always removes the file created On Tue, Feb 10, 2015 at 4:14 PM, Yoshiki Vázquez Baeza <
|
Ah got it. IMHO it's clearer if it's part of the teardown method (maybe On (Feb-10-15|20:38), Joshua Shorenstein wrote:
|
@@ -608,8 +608,8 @@ def get_mountpoint(mount_type, conn_handler=None, retrieve_all=False): | |||
"SELECT data_directory_id, mountpoint, subdirectory FROM " | |||
"qiita.data_directory WHERE data_type='%s' and active=true" | |||
% mount_type)] | |||
|
|||
return [(d, join(get_db_files_base_dir(), m, s)) for d, m, s in result] | |||
basedir = get_db_files_base_dir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand this change, is it required or is for clarity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function does an SQL select every time it's called, so this makes it happen 1 time instead of N times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point! Thanks for catching that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use get_db_files_base_dir
or should we move to the get_mountpoint
function that @antgonza added a while ago?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is within the get_mountpoint function ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I just saw that this is actually the get_mountpoint function
... 😅😇
Few comments @squirrelo |
'SELECT f.* from qiita.filepath f JOIN qiita.analysis_filepath afp ON ' | ||
'f.filepath_id = afp.filepath_id') | ||
for filepath in filepaths: | ||
filename = basename(filepath['filepath']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to verify: these files are still relative to a unique directory associated with a study or a meta-analysis, correct?
Pull from upstream master. |
ready for review again. |
The patch is not working in my machine because the mountpoint has an ending / and the file path doesn't
and I have these values in
|
Should the mount points have a trailing '/'? That technically refers to the contents of the path, not that path |
Got it but the current configuration allows you to have either so
validating both cases or not allowing one in the configuration should
be the way to go.
|
👍 |
@squirrelo conflicts, @ElDeveloper could you merge after conflicts are solved? Thanks. |
This fixes the analysis filepath issues and adds a test to make sure it doesn't happen again.