Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread Steven D'Aprano
On Mon, Jan 08, 2018 at 12:39:07AM +, Alan Gauld via Tutor wrote: > To be fair realpath() does do a tiny bit of magic in that it > checks if the file (or any part of the path) is a link (aka > shortcut) and tries to give you the actual path to the > original file - ie it follows the link. As

Re: [Tutor] Testing

2018-01-07 Thread Steven D'Aprano
On Mon, Jan 08, 2018 at 12:31:06AM +, Alan Gauld wrote: > On 07/01/18 23:38, Steven D'Aprano wrote: > > I've tried emailing in response to the os.path.realpath thread twice, > > and neither email has made it through. > > > > Alan, am I stuck in the moderator queue for some reason? > > Nope, n

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread Alan Gauld via Tutor
On 08/01/18 00:17, boB Stepp wrote: >> The os.path module is mostly a string manipulation toolkit. > > This is the critical piece that was eluding me. I assumed that the > actual file system was being queried, checked and expanded as needed. To be fair realpath() does do a tiny bit of magic in

Re: [Tutor] Testing

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 5:38 PM, Steven D'Aprano wrote: > I've tried emailing in response to the os.path.realpath thread twice, > and neither email has made it through. > > Alan, am I stuck in the moderator queue for some reason? This one made it through. My original answer to your post last nigh

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 8:32 AM, Alan Gauld via Tutor wrote: > On 07/01/18 09:07, boB Stepp wrote: >> clarify this? What is the methodology that os.path.realpath(path) is >> actually following to yield a particular path name? And why does it >> not care if path refers to a real file or not? > > T

[Tutor] Testing

2018-01-07 Thread Steven D'Aprano
I've tried emailing in response to the os.path.realpath thread twice, and neither email has made it through. Alan, am I stuck in the moderator queue for some reason? -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscript

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 4:51 AM, Albert-Jan Roskam wrote: > > On Jan 7, 2018 09:08, Steven D'Aprano wrote: >> realpath() returns the canonical path of the given filename. It doesn't >> try to locate some actual existing file. > > I always thought that os.path.realpath is the Python equivalent of

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread Alan Gauld via Tutor
On 07/01/18 09:07, boB Stepp wrote: > clarify this? What is the methodology that os.path.realpath(path) is > actually following to yield a particular path name? And why does it > not care if path refers to a real file or not? The os.path module is mostly a string manipulation toolkit. It checks

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread Albert-Jan Roskam
On Jan 7, 2018 09:08, Steven D'Aprano wrote: > > On Sun, Jan 07, 2018 at 12:49:59AM -0600, boB Stepp wrote: > > > Win7, Python 3.6.2 > > > > If I run a unit test with the following embedded: > > > > print('realpath =', os.path.realpath('test_main.py')) > > > > I get the following in my test outpu

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 2:05 AM, Steven D'Aprano wrote: > On Sun, Jan 07, 2018 at 12:49:59AM -0600, boB Stepp wrote: > >> Win7, Python 3.6.2 >> >> If I run a unit test with the following embedded: >> >> print('realpath =', os.path.realpath('test_main.py')) >> >> I get the following in my test outpu

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread Steven D'Aprano
On Sun, Jan 07, 2018 at 12:49:59AM -0600, boB Stepp wrote: > Win7, Python 3.6.2 > > If I run a unit test with the following embedded: > > print('realpath =', os.path.realpath('test_main.py')) > > I get the following in my test output (Only relevant line is shown): > > Ensure expected list of s