Skip to content
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

fix: make the crawler runnable and testable on Windows #3830

Merged
merged 7 commits into from
Jan 10, 2023
Merged

fix: make the crawler runnable and testable on Windows #3830

merged 7 commits into from
Jan 10, 2023

Conversation

anakin87
Copy link
Member

@anakin87 anakin87 commented Jan 9, 2023

Related Issues

Proposed Changes:

IS_ROOT = True if os.geteuid() == 0 else False

In the __init__ method of the crawler, os.geteuid() is called.
It only works on Linux.
On Windows, it raises an AttributeError.

My hunch is that on Windows IS_ROOT can be set to False without affecting the proper functioning of the crawler.

How did you test it?

  • Manual verification on Windows 11
  • The crawler is not tested on Windows in the CI. Let's try it and see what happens... ❌
    Since the tests don't properly work on Windows, I'm also changing them a bit

Checklist

@anakin87 anakin87 marked this pull request as ready for review January 9, 2023 18:04
@anakin87 anakin87 requested a review from a team as a code owner January 9, 2023 18:04
@anakin87 anakin87 requested review from julian-risch and removed request for a team January 9, 2023 18:04
@anakin87 anakin87 marked this pull request as ready for review January 10, 2023 11:43
@anakin87 anakin87 changed the title fix: make the crawler work properly on Windows fix: make the crawler runnable and testable on Windows Jan 10, 2023
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍 Great to cover the crawler with CI tests also on Windows. No change requests from my side. I just commented about pathlib's auto-handling of /. I will merge this PR once main branch is green. Thank you for another contribution to Haystack @anakin87 ! 🎉

@@ -18,7 +18,7 @@

@pytest.fixture(scope="session")
def test_url():
return f"file://{SAMPLES_PATH.absolute()}/crawler"
return (SAMPLES_PATH / "crawler").absolute().as_uri()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have pathlib handling the / for unix/windows automatically. 👍 Alternative would have been SAMPLES_PATH.joinpath("crawler").absolute().as_uri()

@julian-risch julian-risch merged commit be31178 into deepset-ai:main Jan 10, 2023
@anakin87 anakin87 deleted the make_crawler_work_on_windows branch January 10, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS Attribute Error while using Crawler
2 participants