Sym two by etiennerichart · Pull Request #814 · bpython/bpython
Repository navigation
Sym two - #814
Merged
thomasballinger merged 24 commits into bpython:master from etiennerichart:sym-two Jul 22, 2020
Merged
Sym two #814 thomasballinger merged 24 commits into bpython:master from etiennerichart:sym-two
Conversation
etiennerichart commented Jun 26, 2020 · edited by thomasballinger Loading
Copy link Copy Markdown
Contributor
Use os.path.realpath to see the source of symbolic links and makes sure that we are not in a loop. Also include importtest.py and importtestfolder to test if program gets stuck in a loop.
Resolves #806
etiennerichart added 9 commits June 25, 2020 19:34
some changes to file reading
f4c0ed6
Some work on symbolic link files
347707d
Cleaned up symlink fix ideas
3f13a28
More clean up
47ea5ee
Make it easier to test different methods
6eff3b2
Found an even better way. useNameSubname = 4
8e08f3a
"Used os.path.realpath to fix issue"
2b96e8d
Removed code that I was using for testing
44f76f7
Made variable to store paths for comparison.
513f37d
thomasballinger
requested changes
Jul 1, 2020
View reviewed changes
thomasballinger left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Thanks for exploring a few options here, I think I like this last one best.
Comment thread bpython/importcompletion.pyOutdated
| for subname in find_modules(pathname): | ||
| if subname != "__init__": | ||
| yield "%s.%s" % (name, subname) | ||
| pathReal = os.path.realpath(pathname) |
Outdated
| if subname != "__init__": | ||
| yield "%s.%s" % (name, subname) | ||
| pathReal = os.path.realpath(pathname) | ||
| if not pathReal in paths: |
Outdated
|
|
||
| def find_modules(path): | ||
| """Find all modules (and packages) for a given directory.""" | ||
|
|
| yield "%s.%s" % (name, subname) | ||
| yield name | ||
|
|
||
|
|
View reviewed changes
etiennerichart added 2 commits July 2, 2020 21:43
further finalize changes to importcompletion.py
01a6a4c
Working on test but am having issues with the try
2edc977
etiennerichart commented Jul 6, 2020
Copy link Copy Markdown
Contributor
Author
|
@thomasballinger I am trying to write the test file but am having an issue with the |
View reviewed changes
thomasballinger left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
See the docs for tempfile.TemporaryDirectory - the files in the temp directory will be erased along with the directory after exiting the context manager.
replaced import test file with them file directory
62bed48
etiennerichart commented Jul 7, 2020
Copy link Copy Markdown
Contributor
Author
|
I have almost finished turning the test class into a test file but for some reason the test is passing when it should not. In the temp directory setup I have it print out what should appear and in what order and the 'Left' file is first. In the actual test 'Left' is last and yet the test still passes. |
View reviewed changes
fixed importtest.py
45ada74
etiennerichart commented Jul 8, 2020 · edited Loading
Copy link Copy Markdown
Contributor
Author
|
I have made the changes so that importtest now works. While I was debugging I used the nosetests -s command and it seems that the temp directory is showing up in (I bolded what I think is the temp dir), '..SS.S...........S..S.......................S...SSSSS...................................................... tmpfaxxkuhx |
sebastinas commented Jul 8, 2020
Copy link Copy Markdown
Contributor
|
Please move the test file to |
moved and renamed importtest to test folder
9fafb2e
etiennerichart
marked this pull request as ready for review
July 8, 2020 20:08
sebastinas
requested changes
Jul 8, 2020
View reviewed changes
sebastinas left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Sorry, I've some more comments that I missed earlier.
etiennerichart added 4 commits July 9, 2020 09:23
cleaned up test file
52cef9f
improved test
6983428
made it so test skips in python 2
5928198
made skipping work
View comments on this commit
dbc1d4f
sebastinas
added this to the
release-0.20 milestone
Jul 11, 2020
thomasballinger
reviewed
Jul 12, 2020
View reviewed changes
Comment thread bpython/test/test_import_not_cyclical.py
Outdated
|
|
||
| else: | ||
| @unittest.skip() | ||
| @unittest.skip( "test doesn't work in python 2" ) |
removed chdir and made better test skip
5f15d7d
thomasballinger commented Jul 15, 2020
Copy link Copy Markdown
Member
|
Now when I run this test after commenting out your fix, it still passes; so I'm worried this isn't testing what we think it is. One problem I see is that sometimes you're using the string 'import_test_folder' when there's no folder that exists with that name. When I run your setup function (and then pause in it so I have time to examine the files) I see that the temporary directory is named
|
fix symbolic links for the test
8bd85e9
used black auto format
0a29731
thomasballinger commented Jul 16, 2020
Copy link Copy Markdown
Member
|
This fails for me locally now, but it looks close. If I sort both lists and print them, I get
Is this passing for you? It occurs to me that this could be nondeterministic since a given module can be referred to mulitple ways based on which filepath got our import discoverer there first, say if |
etiennerichart commented Jul 16, 2020
Copy link Copy Markdown
Contributor
Author
|
I think that the problem is that when going between left and right it went right first whereas on my computer it went left first |
improved test to work on other computers
cec627a
thomasballinger commented Jul 16, 2020
Copy link Copy Markdown
Member
|
Got it, I think we want to change the implementation then to sort. I think wrapping the |
made testing strickter
629bf1e
further testing
11369fc
thomasballinger
requested a review
from sebastinas
July 21, 2020 15:16
thomasballinger commented Jul 21, 2020
Copy link Copy Markdown
Member
|
This alternative approach works for me, import completion will traverse the filesystem in the nondeterministic order determined by os.listdir() but both orders work in the test. @sebastinas thoughts? |
View reviewed changes
sebastinas left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Looks good to me, but please squash the commits when merging the changes.
thomasballinger merged commitb2111bd
into
bpython : master
Jul 22, 2020
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment