Closed pythonmobile closed 12 years ago
Removing this line signal.signal(signal.SIGPIPE, signal.SIG_IGN) -- fixes the import on windows. But is that really a fix?
I think that it is't a good solution. Maybe we can add AttributeError to catch this error. I do't test compatibility with windows and we not declared windows support. If you can test it on windows or fix platform specified features I declared windows support and merge it into repository.
That would be nice. I can try to run the tests.
@Lispython : tried py.test but it did not collect any tests? Does human_curl have tests?
You ask very strange questions. You can look repo and find https://github.com/Lispython/human_curl/blob/master/tests.py
@Lispython Sorry for missing the tests.py staring at me in the main directory. Here is the result of tests on windows after commenting out the sigpipe line.
test_3_legged_oauth (human_curl.tests.AuthManagersTestCase) ... ok test_escape (human_curl.tests.AuthManagersTestCase) ... ok test_generate_nonce (human_curl.tests.AuthManagersTestCase) ... ok test_generate_verifier (human_curl.tests.AuthManagersTestCase) ... ok test_normalize_parameters (human_curl.tests.AuthManagersTestCase) ... ok test_normalize_url (human_curl.tests.AuthManagersTestCase) ... ok test_oauth_HMAC_SHA1 (human_curl.tests.AuthManagersTestCase) ... ok test_oauth_PLAINTEXT (human_curl.tests.AuthManagersTestCase) ... ok test_oauth_consumer (human_curl.tests.AuthManagersTestCase) ... ok test_oauth_token (human_curl.tests.AuthManagersTestCase) ... ok test_parse_authentication_header (human_curl.tests.AuthManagersTestCase) ... ok test_parse_authorization_header (human_curl.tests.AuthManagersTestCase) ... ok test_parse_dict_header (human_curl.tests.AuthManagersTestCase) ... ok test_signature_HMAC_SHA1 (human_curl.tests.AuthManagersTestCase) ... ok test_signature_PLAIN_TEXT (human_curl.tests.AuthManagersTestCase) ... ok test_FILES (human_curl.tests.RequestsTestCase) ... ok test_HEADERS (human_curl.tests.RequestsTestCase) ... ok test_HTTP_DELETE (human_curl.tests.RequestsTestCase) ... ok test_HTTP_GET (human_curl.tests.RequestsTestCase) ... ok test_HTTP_HEAD (human_curl.tests.RequestsTestCase) ... ok test_HTTP_OPTIONS (human_curl.tests.RequestsTestCase) ... ok test_HTTP_POST (human_curl.tests.RequestsTestCase) ... ok test_HTTP_PUT (human_curl.tests.RequestsTestCase) ... ok test_PARAMS (human_curl.tests.RequestsTestCase) ... ok test_POST_DATA (human_curl.tests.RequestsTestCase) ... ok test_POST_DATA_and_FILES (human_curl.tests.RequestsTestCase) ... ok test_POST_RAW_DATA (human_curl.tests.RequestsTestCase) ... ok test_PUT_DATA (human_curl.tests.RequestsTestCase) ... ok test_PUT_DATA_and_FILES (human_curl.tests.RequestsTestCase) ... ok test_PUT_RAW_DATA (human_curl.tests.RequestsTestCase) ... ok test_auth_denied (human_curl.tests.RequestsTestCase) ... ok test_basic_auth (human_curl.tests.RequestsTestCase) ... ok test_build_url (human_curl.tests.RequestsTestCase) ... ok test_cookies_jar (human_curl.tests.RequestsTestCase) ... ok test_digest_auth (human_curl.tests.RequestsTestCase) ... ok test_gzip (human_curl.tests.RequestsTestCase) ... ok test_hooks (human_curl.tests.RequestsTestCase) ... ok test_multivalue_params (human_curl.tests.RequestsTestCase) ... ok test_multivalue_post_data (human_curl.tests.RequestsTestCase) ... ok test_redirect (human_curl.tests.RequestsTestCase) ... ok test_request (human_curl.tests.RequestsTestCase) ... ok test_response_info (human_curl.tests.RequestsTestCase) ... ok test_send_cookies (human_curl.tests.RequestsTestCase) ... ok test_unicode_domains (human_curl.tests.RequestsTestCase) ... ok test_url (human_curl.tests.RequestsTestCase) ... ok tests_invalid_url (human_curl.tests.RequestsTestCase) ... ok test_case_insensitive_dict (human_curl.tests.UtilsTestCase) ... ok test_cookies_from_jar (human_curl.tests.UtilsTestCase) ... ok test_curl_post_files (human_curl.tests.UtilsTestCase) ... ok test_data_wrapper (human_curl.tests.UtilsTestCase) ... ok test_decode_gzip (human_curl.tests.UtilsTestCase) ... ok test_jar_from_cookies (human_curl.tests.UtilsTestCase) ... ok test_morsel_to_cookie (human_curl.tests.UtilsTestCase) ... ok
Ran 53 tests in 8.935s
OK
Do you have any idea of how to test the sigpipe functionality?
Fixed
It seems that issue must be reopened. Got exception "signal only works in main thread" exception then just import human_curl in django development server.
Currently I am added temporary catch for exception.
https://github.com/certator/human_curl/commit/9b06d94b1d7709e674c6c8064ec3a7e967e89188
@certator I don't know source of this bug, but I think that exception handler isn't a good solution.
Thanks for report.
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
--- Installed human_curl using source from github and pycurl (7.19) using .exe bundle.