-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Add unit tests for the bundled compiler and compressor classes #531
Add unit tests for the bundled compiler and compressor classes #531
Conversation
41865f0
to
c8c4f3f
Compare
@jezdez Any feedback on this? |
I think @cyberdelia would be better reviewing this from a conceptual point of view. I could only from a Python perspective tbh. |
@cyberdelia could you give some guidance? |
@@ -97,7 +98,7 @@ def __getitem__(self, key): | |||
value = self.settings[key] | |||
if key.endswith(("_BINARY", "_ARGUMENTS")): | |||
if isinstance(value, string_types): | |||
return tuple(shlex.split(value)) | |||
return tuple(shlex.split(value, posix=(os.sep == '/'))) |
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.
Perhaps use (os.name == 'posix')
instead?
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 had done this because I wasn't sure if any of the other possible values for os.name
had posix-like paths. But it doesn't appear that they do, so that's functionally equivalent and definitely clearer.
c8c4f3f
to
d8af869
Compare
Pull request 531, among many other things, includes a similar fix for the use of `stdout` before it's been assigned. That implementation is a nicer read, so I've switched over to it.
shlex.split(), without posix=False, strips "\" characters, which is obviously problematic on windows.
b71dd5e
to
f03a96a
Compare
@@ -54,3 +62,12 @@ def relpath(path, start=posixpath.curdir): | |||
if not rel_list: | |||
return posixpath.curdir | |||
return posixpath.join(*rel_list) | |||
|
|||
|
|||
def set_std_streams_blocking(): |
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.
It would be nice if this had a docstring explaining what it does and why it's needed.
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.
Done.
Some nodejs executables set stdout and/or stderr to non-blocking, which can trigger an IOError when the collectstatic command prints more than 1024 bytes at a time to stdout or stderr
If this environment variable is not set, multiprocessing throws a NotImplementedError
f03a96a
to
c17fd82
Compare
Looks good! |
…tests Add unit tests for the bundled compiler and compressor classes
Thanks! I'll get to work adding unit tests and documentation to my source map pull request (#490) |
In order to write unit tests for my sourcemap pull request (#490) I needed to have a way in the current testing system to run tests against the possible compilers and compressors available (e.g. scss, closure, uglifyjs). If node is available on the system tox installs npm packages into a local
node_modules
folder, and the settings then use the binaries in that local folder. YUI and closure also check for a java executable in the PATH, and csstidy does not have an npm package so it is the only compiler/compressor that doesn't get bootstrapped in the tox tests.I noticed that you have made some effort to have the unit tests pass on windows, so I kept that in mind here. In the process of writing these tests I found some bugs, the fixes to which I've included in this pull request as separate commits.