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

Removed obsolete TODO in proxy_model_inheritance test. #10303

Merged
merged 1 commit into from Aug 16, 2018

Conversation

htkuan
Copy link
Contributor

@htkuan htkuan commented Aug 16, 2018

I just see this TODO, I think it should be available.

@htkuan
Copy link
Contributor Author

htkuan commented Aug 16, 2018

oh, I miscalculated top-level package, so just clear this todo.

@carltongibson
Copy link
Member

carltongibson commented Aug 16, 2018

Hi @htkuan.

As you'll see from the CI, this fails:

pr/python/python3.5/tests/proxy_model_inheritance/app1/models.py", line 1, in <module>
    from ..app2.models import NiceModel
ValueError: attempted relative import beyond top-level package

The failure shows up locally running the tests:

django/tests  $ ./runtests.py proxy_model_inheritance

Do you think you can debug what's going on here?

@htkuan
Copy link
Contributor Author

htkuan commented Aug 16, 2018

ok! let me debug this.

@htkuan htkuan force-pushed the fix/tests-todo-modify branch 5 times, most recently from 35a4c7b to c838362 Compare August 16, 2018 12:28
@timgraham
Copy link
Member

timgraham commented Aug 16, 2018

Removing the TODO comment seems fine to me.

@htkuan
Copy link
Contributor Author

htkuan commented Aug 16, 2018

I know why can't use '''from ..app2.models import NiceModel''',
Because when call "proxy_model_inheritance/tests.py" file, it will make '_main_' is tests.py.
So when tests.py is '_main_' means dir(proxy_model_inheritance/) not a package.
It cause:

  1. tests.py line.25~26 can't use relative imports
  2. app1/models.py top level package root is app1, so it can't use relative import to find app2
  3. app1/models.py only can use absolute import to find app2

@timgraham timgraham merged commit 9ec1a85 into django:master Aug 16, 2018
@timgraham timgraham changed the title close # TODO: why can't I make this ..app2 Removed obsolete TODO in proxy_model_inheritance test. Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants