Title: Please add an option to skip "cd" to different directories, or convert relative to absolute paths · Issue #174 · codecov/codecov-python · GitHub
Open Graph Title: Please add an option to skip "cd" to different directories, or convert relative to absolute paths · Issue #174 · codecov/codecov-python
X Title: Please add an option to skip "cd" to different directories, or convert relative to absolute paths · Issue #174 · codecov/codecov-python
Description: Noticed something interesting recently fixing another CI error: my AppVeyor results were no longer being uploaded anymore (for who knows how long). I am greatly suspicious of this code: codecov-python/codecov/__init__.py Lines 562 to 565...
Open Graph Description: Noticed something interesting recently fixing another CI error: my AppVeyor results were no longer being uploaded anymore (for who knows how long). I am greatly suspicious of this code: codecov-pyt...
X Description: Noticed something interesting recently fixing another CI error: my AppVeyor results were no longer being uploaded anymore (for who knows how long). I am greatly suspicious of this code: codecov-pyt...
Opengraph URL: https://github.com/codecov/codecov-python/issues/174
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Please add an option to skip \"cd\" to different directories, or convert relative to absolute paths","articleBody":"Noticed something interesting recently fixing another CI error: my AppVeyor results were no longer being uploaded anymore (for who knows how long). I am greatly suspicious of this code:\r\n\r\nhttps://github.com/codecov/codecov-python/blob/0743daa83647f12ff31b84d07113d2c24c27b924/codecov/__init__.py#L562-L565\r\n\r\n### Failed build\r\n\r\n[Full build log here](https://ci.appveyor.com/project/svenevs/exhale/builds/21187044/job/s46vy07b2e5yttju#L206), specifically this part is curious because this used to work as expected with `codecov` on this repo:\r\n\r\n```\r\n==\u003e Collecting reports\r\nXX\u003e Searching for reports disabled\r\n Targeting specific files\r\n - Ignored: [Errno 2] No such file or directory: '.\\\\coverage.xml'\r\nError: No coverage report found\r\n```\r\n\r\n### Solution: must use absolute path now\r\n\r\n```diff\r\n--- a/.appveyor.yml\r\n+++ b/.appveyor.yml\r\n@@ -94,6 +94,6 @@ after_test:\r\n Invoke-Expression $codecov_cmd\r\n }\r\n else {\r\n- $codecov_cmd = '\u0026 codecov -X gcov -f .\\coverage.xml --name ' + $env:TEST_NAME\r\n+ $codecov_cmd = '\u0026 codecov -X gcov -f c:\\projects\\exhale\\coverage.xml --name ' + $env:TEST_NAME\r\n Invoke-Expression $codecov_cmd\r\n }\r\n```\r\n\r\n### My Guess\r\n\r\nI don't think you can just do `cd \u003csomewhere\u003e \u0026\u0026 other_stuff || different_stuff` on windows in general. So what I believe happens is the `cd` is successful, but the rest fails and then `codecov` never goes back.\r\n\r\nIn general, it's worth mentioning that this repo has a lot of patterns like this that should probably be a little more careful. Another small example that could cause problems:\r\n\r\nhttps://github.com/codecov/codecov-python/blob/0743daa83647f12ff31b84d07113d2c24c27b924/codecov/__init__.py#L493\r\n\r\nI think that the python script was probably just adapted from the bash script and maybe that's why all of these are in here? Unfortunately, there's a large number of them...but this is why there are generally so many problems on AppVeyor.\r\n\r\nFor the `cd` (suspected) problem, you may want to introduce a simple context manager so that you can do\r\n\r\n```py\r\nwith cd(some_path):\r\n execute_stuff()\r\n```\r\n\r\nwhere the context manager will go back to where it came from (lots of examples online, [here's a good starting place](https://stackoverflow.com/a/24176022)).\r\n\r\nOr an even easier solution that would be much faster is specifically when you get a `-f \u003csome_path\u003e` you can check\r\n\r\n```py\r\n# suppose it was called this\r\nfile_path = args[\"-f\"] # just an example...\r\nif not os.path.isabs(file_path):\r\n file_path = os.path.abspath(file_path)\r\n```\r\n\r\nor similar. Basically, make everything absolute before you start \"cd'ing\" around :upside_down_face:\r\n\r\nHappy to help implement changes with more input on what you want here.","author":{"url":"https://github.com/svenevs","@type":"Person","name":"svenevs"},"datePublished":"2018-12-22T01:02:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/174/codecov-python/issues/174"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0cb5e16d-37ac-ff92-ec1d-6404f7960ea3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA42:117F59:16866EB:2057DA6:6A4CCDD8 |
| html-safe-nonce | 987701134e3629ded8fc2338d9145c962c5662c718d623a06f28fe0bc5bc4b80 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTQyOjExN0Y1OToxNjg2NkVCOjIwNTdEQTY6NkE0Q0NERDgiLCJ2aXNpdG9yX2lkIjoiNzI4NDgwOTM5MTA1NTYyMTU5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5ccbc1116007f6709413dc3e506d414867905b5dd8f8d85b3e704fc38a1394a9 |
| hovercard-subject-tag | issue:393628983 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codecov/codecov-python/174/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9bdb9c0059d09e6fc1a62968efe2c2cbd601c2c0e3512dd567e49795cae7a8e6/codecov/codecov-python/issues/174 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9bdb9c0059d09e6fc1a62968efe2c2cbd601c2c0e3512dd567e49795cae7a8e6/codecov/codecov-python/issues/174 |
| og:image:alt | Noticed something interesting recently fixing another CI error: my AppVeyor results were no longer being uploaded anymore (for who knows how long). I am greatly suspicious of this code: codecov-pyt... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | svenevs |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee8a9d18044a05fe2d57b9ae797da38c8be34effb03f015f7c42e94770d28a1b |
| turbo-cache-control | no-preview |
| go-import | github.com/codecov/codecov-python git https://github.com/codecov/codecov-python.git |
| octolytics-dimension-user_id | 8226205 |
| octolytics-dimension-user_login | codecov |
| octolytics-dimension-repository_id | 22685735 |
| octolytics-dimension-repository_nwo | codecov/codecov-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22685735 |
| octolytics-dimension-repository_network_root_nwo | codecov/codecov-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f84814acc6f036583fd43463f5847a846243d2a4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width