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

fixed paths for pip install #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FedeClaudi
Copy link

@FedeClaudi FedeClaudi commented Nov 1, 2020

Hi @SylvainDe,

I know you have another PR that fixes this module's imports to make it work with pip install (#52), but it's a bit outdated so I thought I'd open a new one.

The fix is fairly simple, where before you had:

from didyoumean_common_tests import (
    TestWithStringFunction,
    get_exception,
    no_exception,
    NoFileIoError,
    unittest_module
    )

now it's

from .didyoumean_common_tests import (
    TestWithStringFunction,
    get_exception,
    no_exception,
    NoFileIoError,
    unittest_module
    )

notice the . before didyoumean_common_tests, that tells python's importer to import those functions from the didyoumean_common_tests of didyoumean.

Similarly:

import didyoumean_common_tests as common

becomes

from didyoumean import didyoumean_common_tests as common

Hope that this helps clarify things a little bit, it might take a bit to wrap your head around how to import stuff (I know it took me quite a while).


Btw I've moved readme_examples.py outside of the package's folder because generally code for examples and tests should be separate from the package's code (e.g. see folder structure here).
Feel free to move it back if you prefer

Copy link
Owner

@SylvainDe SylvainDe left a comment

Choose a reason for hiding this comment

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

Thanks for the nice work and the (much needed) explanation :)
I'll try my best not to make this one stale.

Unfortunately (?), you few style issues have been caught by the CI:

  • trailing whitespace (W291)
  • missing new lines (E302 / W292 )

Would you mind fixing these (or for the later disabling in the .travis file) ? Otherwise, I can merge it and fix this myself/

didyoumean/didyoumean_api_tests.py Show resolved Hide resolved
didyoumean/didyoumean_internal_tests.py Outdated Show resolved Hide resolved
didyoumean/didyoumean_sugg_tests.py Outdated Show resolved Hide resolved
didyoumean/__init__.py Outdated Show resolved Hide resolved
@FedeClaudi
Copy link
Author

Bumped a new commit with fixes for those errors

@SylvainDe
Copy link
Owner

Wow, that was fast!

didyoumean/__init__.py Show resolved Hide resolved
@SylvainDe
Copy link
Owner

Many thanks for the 3 iterations! Now, the CI is detecting more interesting issues... which may be caused by a few things that were done improperly in my original code. I'll try to get a better understanding of what we have...
(Also, I guess I may have to drop support for older Python versions)

@FedeClaudi
Copy link
Author

mmm that's weird, I haven't run the tests but the package worked fine for me..
I've only used pytest for running tests though, so not sure what the problem is here.

@FedeClaudi
Copy link
Author

it might help to keep you test code and your package code separate, that might be the cause of error (it complains about relative imports)

@SylvainDe
Copy link
Owner

FYI, I've started to try out a few things on https://github.com/SylvainDe/DidYouMean-Python/tree/testingPr53 with very limited success. I'll keep you posted if I do thing something interesting in the future and merge your PR at that point.

@FedeClaudi
Copy link
Author

sounds good, good luck!

@alexmojaki
Copy link

@SylvainDe ping for this or any of the three PRs attacking the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants