Title: Invalid python sys path to directory with tested file on Windows · Issue #2673 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Invalid python sys path to directory with tested file on Windows · Issue #2673 · UnitTestBot/UTBotJava
X Title: Invalid python sys path to directory with tested file on Windows · Issue #2673 · UnitTestBot/UTBotJava
Description: Description UnitTestBot generates tests with invalid sys.path on Windows when "Test sources root" coincides with file under test. To Reproduce Steps to reproduce the behavior: Run a python project in Pycharm Use plugin to generate tests ...
Open Graph Description: Description UnitTestBot generates tests with invalid sys.path on Windows when "Test sources root" coincides with file under test. To Reproduce Steps to reproduce the behavior: Run a python project ...
X Description: Description UnitTestBot generates tests with invalid sys.path on Windows when "Test sources root" coincides with file under test. To Reproduce Steps to reproduce the behavior: Run a pytho...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/2673
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid python sys path to directory with tested file on Windows","articleBody":"**Description**\r\n\r\nUnitTestBot generates tests with invalid sys.path on Windows when \"Test sources root\" coincides with file under test.\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n1. Run a python project in Pycharm\r\n2. Use plugin to generate tests and set a path to directory with tested file in the field \"Test sources root\"\r\n3. Open the generated test\r\n\r\n**Expected behavior**\r\n\r\nValid tests with correct sys paths\r\n\r\n**Actual behavior**\r\n\r\nValid tests with incorrect sys path (`sys.path.append(os.path.dirname(__file__) + r'\\')`). The problem is that python raw-string cannot end in backslash.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\nTested function\r\n\r\n\r\nUTBot window\r\n\r\n\r\nsys.path\r\n\r\n\r\n**Environment**\r\n\r\n__Windows__ + specified above \"Test sources root\"\r\n\r\n**Solutions**\r\n1. Replace backslash at the end by \"\\\\.\"\r\n2. Remove backslash at the end\r\n3. Skip sys.path if it coincides with tested function directory\r\n","author":{"url":"https://github.com/tamarinvs19","@type":"Person","name":"tamarinvs19"},"datePublished":"2023-11-03T09:16:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2673/UTBotJava/issues/2673"}
| 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:61c24732-dad1-1844-06b5-788939de52ff |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A2EA:C74F6:101B1D:14564B:69903DC8 |
| html-safe-nonce | 56433d2400d6c2aa0f0e0ae5d3abd66be0969d29d6977391d4e75f11ac94549f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMkVBOkM3NEY2OjEwMUIxRDoxNDU2NEI6Njk5MDNEQzgiLCJ2aXNpdG9yX2lkIjoiMTczMjQyMDMwMzc5ODE1Njc0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c76424ab6bf34a71a3afe0ff58f011524b0bbd7772a1ed020dd4d3b0d0e870ec |
| hovercard-subject-tag | issue:1975750989 |
| 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/UnitTestBot/UTBotJava/2673/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c7e8a815f56a6a1aeca996a4738c5518c62721e2a519dcd9e3ae4fc29806f0e4/UnitTestBot/UTBotJava/issues/2673 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c7e8a815f56a6a1aeca996a4738c5518c62721e2a519dcd9e3ae4fc29806f0e4/UnitTestBot/UTBotJava/issues/2673 |
| og:image:alt | Description UnitTestBot generates tests with invalid sys.path on Windows when "Test sources root" coincides with file under test. To Reproduce Steps to reproduce the behavior: Run a python project ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tamarinvs19 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| 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 | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width