Re: permission denied when installing tensorflow on centos 7

2018-04-30 Thread dieter
joseph pareti  writes:
> here are details on my attempt:
> ...
> [joepareti54@xxx tensorflow_tmpdir]$ pip3 install --upgrade virtualenv >>
> step3.txt 2>&1
> [joepareti54@xxx tensorflow_tmpdir]$ cat step3.txt
> Collecting virtualenv
>   Downloading
> https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl
> (2.6MB)
> Installing collected packages: virtualenv
> Exception:
> Traceback (most recent call last):
> ...
>   File "/anaconda/envs/py35/lib/python3.5/shutil.py", line 115, in copyfile
> with open(dst, 'wb') as fdst:
> PermissionError: [Errno 13] Permission denied:
> '/anaconda/envs/py35/lib/python3.5/site-packages/virtualenv.py'

It looks as it would try to overwrite an existing (write protected)
"virtualenv.py". Likely, it should not do that.

You could try to work around this problem by allowing to overwrite
"virtualenv.py" (and maybe other files as well) --> "chmod" command.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Youta TAKAOKA
I am using pipenv...

http://docs.pipenv.org/en/latest/

It has bootstrap probrem.
pyenv solves it, but windows is NOT a first-class citizen for pyenv.

2018年5月1日(火) 14:00 Percival John Hackworth :

> On 30-Apr-2018, Chris Angelico wrote
> (in article):
>
> > https://xkcd.com/1987/
> >
> > So take-away is: On a Mac, just use Homebrew.
> >
> > (Cue the angry hordes telling me how wrong I am.)
> >
> > ChrisA
>
> This comic is talking about python on his Mac installed via home brew.
>
> I chose to keep the 2.[67] versions installed with the base install and
> install the V3 versions from the Python web site. They install in
> /Library/Frameworks/Python.
>
> https://www.python.org/downloads/
>
> I could have also used the 2.7.15 version on that site, but I'll keep with
> the 2.7.10 that's part of the base install of 10.10. I deleted the
> versions
> installed by port and homebrew so all the cruft is gone.
>
> Then I upgraded pip from the ancient version to 10.0.1 using easy_install.
> python3 and and python3.6 are soft links to the /Library/Frameworks
> version.
> My /etc/paths.d/python3 config file adds /Library/Frameworks to the global
> path, but I think that's MacOS specific.
>
> There's more than one way to do this, but it's for a personal machine, not
> a
> global environment that multiple developers will use, so YMMV.
>
> --
> DeeDee, don't press that button! DeeDee! NO! Dee...
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASE] Python 2.7.15

2018-04-30 Thread Hasan Diwan
Congrats to all involved! -- H

On 30 April 2018 at 21:09, Benjamin Peterson  wrote:

> Greetings,
> I'm pleased to announce the immediate availability of Python 2.7.15, the
> latest bug fix release in the senescent Python 2.7 series.
>
> Source and binary downloads may be found on python.org:
>
>  https://www.python.org/downloads/release/python-2715/
>
> Bugs should be reported to https://bugs.python.org/
>
> The source tarball contains a complete changelog in the Misc/NEWS file.
> The only change since the release candidate is a fix for undefined C
> behavior that newer compilers (including GCC 8) have started to exploit.
>
> Users of the macOS binaries should note that all python.org macOS
> installers now ship with a builtin copy of OpenSSL. Additionally, there is
> a new additional installer variant for macOS 10.9+ that includes a built-in
> version of Tcl/Tk 8.6. See the installer README for more information.
>
> Happy May,
> Benjamin
> 2.7 release manager
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> hasan.diwan%40gmail.com
>



-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
http://bit.ly/hd1ScheduleRequest.
Si vous voudrais faire connnaisance, allez a
http://bit.ly/hd1ScheduleRequest.

Sent
from my mobile device
Envoye de mon portable
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 2.7.15

2018-04-30 Thread Benjamin Peterson
Greetings,
I'm pleased to announce the immediate availability of Python 2.7.15, the latest 
bug fix release in the senescent Python 2.7 series.

Source and binary downloads may be found on python.org:

 https://www.python.org/downloads/release/python-2715/

Bugs should be reported to https://bugs.python.org/

The source tarball contains a complete changelog in the Misc/NEWS file. The 
only change since the release candidate is a fix for undefined C behavior that 
newer compilers (including GCC 8) have started to exploit.

Users of the macOS binaries should note that all python.org macOS installers 
now ship with a builtin copy of OpenSSL. Additionally, there is a new 
additional installer variant for macOS 10.9+ that includes a built-in version 
of Tcl/Tk 8.6. See the installer README for more information.

Happy May,
Benjamin
2.7 release manager
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Terry Reedy

On 4/30/2018 5:03 PM, Chris Angelico wrote:


Yep. Munroe (the author of XKCD) is clearly using a Mac, though, and
Macs don't ship with Python 3.5+. So there's a bootstrapping problem:
how do you install a newer Python? There are about half a dozen
options.


I think the situation is improved with 3.7 Mac installer, which includes 
and installs an up-to-date tcl/tk, instead of telling people, on a 
separate page that many do not go to, to separately install a less 
ancient tcl/tk from ActiveState, which some have trouble doing, or 
switch to another distribution, which has its own issues.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Terry Reedy

On 4/30/2018 5:03 PM, Chris Angelico wrote:

On Tue, May 1, 2018 at 6:59 AM, justin walters
 wrote:

With Python 3.5+, venv is a built in module. If using a venv, default to
using the binary in the venv.

That's what I do anyways.


Yep. Munroe (the author of XKCD) is clearly using a Mac, though, and
Macs don't ship with Python 3.5+. So there's a bootstrapping problem:
how do you install a newer Python? There are about half a dozen
options.

ChrisA




--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Rich Shepard

On Mon, 30 Apr 2018, justin walters wrote:


Yes, you can create a virtual env with all of the global packages. Though,
you would probably want to run: `python3 -m venv
~/development/project/venv` to put the virtualenv files in their own
directory.


Justin,

  That's what I thought to be the case after reading the python docs about
the venv module.

Thanks!

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread justin walters
On Mon, Apr 30, 2018 at 3:24 PM, Rich Shepard 
wrote:

> On Mon, 30 Apr 2018, justin walters wrote:
>
> With Python 3.5+, venv is a built in module. If using a venv, default to
>> using the binary in the venv. That's what I do anyways.
>>
>
>   I'm running Python3-3.6.5 and have a developing application in
> ~/development/project/. Can I run 'python3 -m venv ~/development/project/'
> to install it in a directory with existing modules?
>
> Rich
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Yes, you can create a virtual env with all of the global packages. Though,
you would probably want to run:
`python3 -m venv ~/development/project/venv` to put the virtualenv files in
their own directory. Then you
just need to activate it with: `source venv/bin/activate`. As long as the
virtualenv is activated, you can interact
with it in the same way you would with the system/global environment. i.e.
running the interpreter will use the binary
from the virtualenv, pip install will install in the virtualenv only, etc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Rich Shepard

On Mon, 30 Apr 2018, justin walters wrote:


With Python 3.5+, venv is a built in module. If using a venv, default to
using the binary in the venv. That's what I do anyways.


  I'm running Python3-3.6.5 and have a developing application in
~/development/project/. Can I run 'python3 -m venv ~/development/project/'
to install it in a directory with existing modules?

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 7:16 AM, Tim Chase  wrote:
> On 2018-05-01 06:40, Chris Angelico wrote:
 >> https://xkcd.com/1987/
>>>
>>> I feel like this problem is pretty handily solved by virtual
>>> environments. Also, if a single project requires all of this,
>>> perhaps Python isn't the best choice for the project.
>>
>> Some of it is definitely solved by venvs. But which Python binary do
>> you use?
>
> Pretty sure that all venvs I've used know their corresponding binary.
> But...

Right. It's locked in when you create it. But you still have to pick.

>> And is venv installed? Do you need to install virtualenv
>> first? How do you...
>
> Is it virtualenv?  Or are you using virtualenvwrapper which, last I
> checked doesn't work in ksh (OpenBSD's default shell) without jumping
> through hoops and getting external ksh-specific files?  Or are you
> using pipenv?  Or `python -m venv`?  So many different flavors. :-(
>

Exactly! Personally, I don't use any of them except "python3 -m venv",
but I also have some custom bash scripting to make the activation and
deactivation happen automatically.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Tim Chase
On 2018-05-01 06:40, Chris Angelico wrote:
>>> >> https://xkcd.com/1987/
>>
>> I feel like this problem is pretty handily solved by virtual
>> environments. Also, if a single project requires all of this,
>> perhaps Python isn't the best choice for the project.  
> 
> Some of it is definitely solved by venvs. But which Python binary do
> you use? 

Pretty sure that all venvs I've used know their corresponding binary.
But...

> And is venv installed? Do you need to install virtualenv
> first? How do you... 

Is it virtualenv?  Or are you using virtualenvwrapper which, last I
checked doesn't work in ksh (OpenBSD's default shell) without jumping
through hoops and getting external ksh-specific files?  Or are you
using pipenv?  Or `python -m venv`?  So many different flavors. :-(

-tkc




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 6:59 AM, justin walters
 wrote:
> With Python 3.5+, venv is a built in module. If using a venv, default to
> using the binary in the venv.
>
> That's what I do anyways.

Yep. Munroe (the author of XKCD) is clearly using a Mac, though, and
Macs don't ship with Python 3.5+. So there's a bootstrapping problem:
how do you install a newer Python? There are about half a dozen
options.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread justin walters
On Mon, Apr 30, 2018 at 1:40 PM, Chris Angelico  wrote:

> On Tue, May 1, 2018 at 6:22 AM, justin walters
>  wrote:
> > On Mon, Apr 30, 2018 at 10:32 AM, Chris Angelico 
> wrote:
> >
> >> On Tue, May 1, 2018 at 3:30 AM, Ned Batchelder 
> >> wrote:
> >> > On 4/30/18 1:15 PM, Chris Angelico wrote:
> >> >>
> >> >> https://xkcd.com/1987/
> >> >>
> >> >> So take-away is: On a Mac, just use Homebrew.
> >> >>
> >> >> (Cue the angry hordes telling me how wrong I am.)
> >> >>
> >> >
> >> > My take-away (though not really, since I held this view before this
> >> > morning): pick a way and stick to it.
> >>
> >> Well, yes. Until that way stops working, in which case you have to try
> >> another way. And that's when the problems start...
> >>
> >> ChrisA
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
> >>
> >
> > I feel like this problem is pretty handily solved by virtual
> environments.
> > Also, if a single project requires all of this,
> > perhaps Python isn't the best choice for the project.
>
> Some of it is definitely solved by venvs. But which Python binary do
> you use? And is venv installed? Do you need to install virtualenv
> first? How do you... etc, etc, etc, etc, etc. Endless fun!
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

With Python 3.5+, venv is a built in module. If using a venv, default to
using the binary in the venv.

That's what I do anyways.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 6:22 AM, justin walters
 wrote:
> On Mon, Apr 30, 2018 at 10:32 AM, Chris Angelico  wrote:
>
>> On Tue, May 1, 2018 at 3:30 AM, Ned Batchelder 
>> wrote:
>> > On 4/30/18 1:15 PM, Chris Angelico wrote:
>> >>
>> >> https://xkcd.com/1987/
>> >>
>> >> So take-away is: On a Mac, just use Homebrew.
>> >>
>> >> (Cue the angry hordes telling me how wrong I am.)
>> >>
>> >
>> > My take-away (though not really, since I held this view before this
>> > morning): pick a way and stick to it.
>>
>> Well, yes. Until that way stops working, in which case you have to try
>> another way. And that's when the problems start...
>>
>> ChrisA
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
> I feel like this problem is pretty handily solved by virtual environments.
> Also, if a single project requires all of this,
> perhaps Python isn't the best choice for the project.

Some of it is definitely solved by venvs. But which Python binary do
you use? And is venv installed? Do you need to install virtualenv
first? How do you... etc, etc, etc, etc, etc. Endless fun!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread justin walters
On Mon, Apr 30, 2018 at 10:32 AM, Chris Angelico  wrote:

> On Tue, May 1, 2018 at 3:30 AM, Ned Batchelder 
> wrote:
> > On 4/30/18 1:15 PM, Chris Angelico wrote:
> >>
> >> https://xkcd.com/1987/
> >>
> >> So take-away is: On a Mac, just use Homebrew.
> >>
> >> (Cue the angry hordes telling me how wrong I am.)
> >>
> >
> > My take-away (though not really, since I held this view before this
> > morning): pick a way and stick to it.
>
> Well, yes. Until that way stops working, in which case you have to try
> another way. And that's when the problems start...
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

I feel like this problem is pretty handily solved by virtual environments.
Also, if a single project requires all of this,
perhaps Python isn't the best choice for the project.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Mark Lawrence

On 30/04/18 19:41, Bill Deegan wrote:

back up for me.



Ditto :)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Bill Deegan
back up for me.

On Mon, Apr 30, 2018 at 2:26 PM, Mark Lawrence 
wrote:

> On 30/04/18 19:17, Paul Moore wrote:
>
>> It's working for me now.
>> Paul
>>
>> On 30 April 2018 at 18:38, Jorge Gimeno  wrote:
>>
>>> Not sure who to report to, but the site comes back with a 503. Anyone
>>> know
>>> where I can direct this to?
>>>
>>> -Jorge L. Gimeno
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
> When originally reported I was getting, and am still getting, 502.
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Mark Lawrence

On 30/04/18 19:17, Paul Moore wrote:

It's working for me now.
Paul

On 30 April 2018 at 18:38, Jorge Gimeno  wrote:

Not sure who to report to, but the site comes back with a 503. Anyone know
where I can direct this to?

-Jorge L. Gimeno
--
https://mail.python.org/mailman/listinfo/python-list


When originally reported I was getting, and am still getting, 502.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Bill Deegan
Still 502 for me.

On Mon, Apr 30, 2018 at 2:17 PM, Paul Moore  wrote:

> It's working for me now.
> Paul
>
> On 30 April 2018 at 18:38, Jorge Gimeno  wrote:
> > Not sure who to report to, but the site comes back with a 503. Anyone
> know
> > where I can direct this to?
> >
> > -Jorge L. Gimeno
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Bill Deegan
Ditto. I see a 502.

On Mon, Apr 30, 2018 at 1:38 PM, Jorge Gimeno  wrote:

> Not sure who to report to, but the site comes back with a 503. Anyone know
> where I can direct this to?
>
> -Jorge L. Gimeno
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: www.python.org down

2018-04-30 Thread Paul Moore
It's working for me now.
Paul

On 30 April 2018 at 18:38, Jorge Gimeno  wrote:
> Not sure who to report to, but the site comes back with a 503. Anyone know
> where I can direct this to?
>
> -Jorge L. Gimeno
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


www.python.org down

2018-04-30 Thread Jorge Gimeno
Not sure who to report to, but the site comes back with a 503. Anyone know
where I can direct this to?

-Jorge L. Gimeno
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Chris Angelico
On Tue, May 1, 2018 at 3:30 AM, Ned Batchelder  wrote:
> On 4/30/18 1:15 PM, Chris Angelico wrote:
>>
>> https://xkcd.com/1987/
>>
>> So take-away is: On a Mac, just use Homebrew.
>>
>> (Cue the angry hordes telling me how wrong I am.)
>>
>
> My take-away (though not really, since I held this view before this
> morning): pick a way and stick to it.

Well, yes. Until that way stops working, in which case you have to try
another way. And that's when the problems start...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The perils of multiple Pythons

2018-04-30 Thread Ned Batchelder

On 4/30/18 1:15 PM, Chris Angelico wrote:

https://xkcd.com/1987/

So take-away is: On a Mac, just use Homebrew.

(Cue the angry hordes telling me how wrong I am.)



My take-away (though not really, since I held this view before this 
morning): pick a way and stick to it.


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


The perils of multiple Pythons

2018-04-30 Thread Chris Angelico
https://xkcd.com/1987/

So take-away is: On a Mac, just use Homebrew.

(Cue the angry hordes telling me how wrong I am.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Inconsistent site.py behavior between venv and system

2018-04-30 Thread Demian Brecht
I recently ran into an issue using the site package and I wanted to confirm 
that I'm not doing something wrong here before creating an issue:

I have a need to `git subtree` modules into a Django project and then add the 
dependencies such that they're discoverable in code. I also need to have 
consistent behavior between `python setup.py (develop|install)` and `pip 
install -r requirements.txt` (the latter is used by Heroku for project 
installation). An example project that demonstrates the issue is here: 
https://github.com/demianbrecht/python-sitehooks-example.

In the example, I've subtree'd requests into _vendor and forced site hooks to 
fire using `site.main()` in testme/settings.py: 
https://github.com/demianbrecht/python-sitehooks-example/commit/1b81e15c6f28bc80a4f984cffa78eb2ced80a320.
 Forcing the execution is not needed when the package is actually installed 
using setup.py, but is needed when using `pip install -r requirements.txt`. 
This works great when running within a virtualenv, but I get the following on 
system python:

$ python3.6 ./manage.py test
Traceback (most recent call last):
  File "./manage.py", line 22, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", 
line 364, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", 
line 308, in execute
settings.INSTALLED_APPS
  File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 
56, in __getattr__
self._setup(name)
  File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 
41, in _setup
self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 
110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 978, in _gcd_import
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 655, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 205, in _call_with_frames_removed
  File "///testme/testme/settings.py", line 13, in 
site.main()
  File "/usr/local/lib/python3.6/site.py", line 525, in main
abs_paths()
  File "/usr/local/lib/python3.6/site.py", line 110, in abs_paths
m.__cached__ = os.path.abspath(m.__cached__)
  File "/usr/local/lib/python3.6/posixpath.py", line 369, in abspath
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Using venv and system comparisons for debugging doesn't help much as site.py is 
different in the two environments. Any insight into what may be going on here 
or what I'm doing wrong would be much appreciated. I realize that I could just 
muck with PYTHONPATH, but I thought this approach would be a little nicer as 
it's transparent to the user.

---
GPG Fingerprint: 9ACFB014BA1E5B4939ACA3B214E4E96742F22903



signature.asc
Description: Message signed with OpenPGP
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unittest.Testsuite and execution order

2018-04-30 Thread George Fischhof
On 20 Apr 2018 8:39 am, "Chris Angelico"  wrote:

On Fri, Apr 20, 2018 at 3:01 PM, Francesco Russo 
wrote:
> On 18/04/18 20:26, Chris Angelico wrote:
>> This is a bad idea. Each function that starts test_ should be
>> completely independent. You should be able to run any one of them on
>> its own (say, if you're trying to figure out why your latest change
>> caused a test failure), and it should have the same result.
>>
>> Make it so that test_func_1 and test_func_2 are completely
>> independent, and then, if you need a single test that uses both, have
>> a test that calls on each function.
>
> I'm not sure I understand you here.
> I understood that (besides, or instead of, making an integration test by
> making those tests into one test, as you wrote above) I could make a
> test for func_2 making it independent from func_1, for example this way:
>
> class MyTestFunc2(unittest.TestCase):
>def setUp(self):
>   # Prepare preconditions for func_2
>
>def test_func_2(self):
>   sut.func_2()
>   self.assert(...)
>
> Such a test case wouldn't even need a test suite.
> Is this what you meant?

What I mean is that test_func_1 and test_func_2 should be able to pass
or fail regardless of whether the other has been run or not. That kind
of independence. If you then want to write an integration test that
verifies that data created by func_1 can be read by func_2, that is a
separate test.

> The official "unittest" web pages for Python 2 and 3 say this, for the
> TestSuite class:
> *This class represents an aggregation of individual tests cases and test
> suites*
> saying nothing about the order. But the docstring of the TestSuite class
> says:
> *It will run the individual test cases in the order in which they were
> added, aggregating the results*
> Can I consider the docstring an official documentation as well?
>

That's something for other people to answer; I don't know whether
TestSuite is a replaceable class. I'm not sure what the mechanics are
for test randomization, but it is most definitely a thing.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list



Hi,

If you want to use more asserts in a test case, you should use
pytest-assume plugin.

George
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Flask test generator code review?

2018-04-30 Thread George Fischhof
2018-04-18 12:41 GMT+02:00 Albert-Jan Roskam :

> Hi,
>
> I am writing my first unittests for a Flask app. First modest goal is to
> test whether a selected subset of the templates return the expected status
> 200.
> I am using a nose test generator in a class for this. Is the code below
> the correct way to do this? And is there a way to dynamically set the
> docstring of test_generator? This would make the nosetests output a bit
> more understandable.
>
> Thanks!
> Albert-Jan
>
> import os
> import sys
> from os.path import splitext
> from http import HTTPStatus as status
>
> import nose
>
> from MyFabulousApp import app
>
> app.testing = True
> template_folder = app.config['TEMPLATE_FOLDER']
>
>
> class Test_MyFabulousApp_HTTP_Status_OK:
>
> def __init__(self):
> self.setup()   # with unittest, setUp is called automatically, but
> not with nose
>
> def setup(self):
> self.client = app.test_client()
> self.client.post('/login', follow_redirects=True)
>
> def teardown(self):
> self.client.post('/logout', follow_redirects=True)
>
> def test_generator(self):
> """Does template return HTTP Status 200?"""
> def the_test(self, template):
> # the following line throws an error: AttributeError:
> attribute '__doc__' of 'method' objects is not writable
> #self.test_generator.__doc__ = 'Does template "%s" return HTTP
> Status 200?' % template
> respons = self.client.get('/' + template)
> actual = respons.status_code
> desired = status.OK.value
> assert actual == desired, \
>'Template "%s" returns status code %d' % (template, actual)
> templates = [splitext(item)[0] for item in
> os.listdir(template_folder)]
> for template in templates:
> yield the_test, self, template
>
>
> if __name__ == '__main__':
> nose.run(defaultTest=__name__, argv=[sys.argv[0], '__main__',
> '--verbosity=2'])
> --
> https://mail.python.org/mailman/listinfo/python-list
>


Hi,

maybe you should check PyTest
https://docs.pytest.org/en/latest/

and Flas testing turorial:
http://flask.pocoo.org/docs/1.0/testing/


BR,
George
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to add values from test steps in pytest excel report

2018-04-30 Thread George Fischhof
On 27 Apr 2018 9:49 am, "Sum"  wrote:

Hi,

I am using python 2.7 and pytest version 3.2.1
I am using pytest excel plugin to run the pytest and generate test report
in excel format.

Step to install pytest excel : pip install pytest-excel

I am running my pytest test using below :

py.test --excelreport=report.xls e_test.py

Output Test report excel format :

SUITE NAME  TEST NAME   DESCRIPTION RESULT  DURATIONMESSAGE FILE
NAME   MARKERSTestSumFlow test_step1  PASSED  15.24737811
e_test.py

My query is that I want to display the values from my corresponding test
steps in pytest.
e.g. if my test step is following, then how do I display the output of
test_step1 "newNum" in the excel report.

def test_step1(fNum, sNum):
newNum = fNum - sNum
print newNum


Regards,
Sumit
-- 
https://mail.python.org/mailman/listinfo/python-list



Hi Sumit,

You should use assert for testing:
assert new_num == f_num - s_num, "Message if assert is false"

or if you want to use more checking, you should use pytest.assume plugin.

If you just want to write something to output, you should use logging, here
are some info about logging in pytest:
https://docs.pytest.org/en/latest/logging.html


BR,
George
-- 
https://mail.python.org/mailman/listinfo/python-list


permission denied when installing tensorflow on centos 7

2018-04-30 Thread joseph pareti
here are details on my attempt:


tensorflow for centos 7 installation guidelines are in:
https://gist.github.com/thoolihan/28679cd8156744a62f88

sudo yum -y install epel-release
sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel
gcc- gfortran openssl-devel libffi-devel
# use pip or pip3 as you prefer for python or python3
pip install --upgrade virtualenv
virtualenv --system-site-packages ~/venvs/tensorflow
source ~/venvs/tensorflow/bin/activate
pip install --upgrade numpy scipy wheel cryptography #optional
pip install --upgrade
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-
cp35m-linux_x86_64.whl
# or below if you want gpu, support, but cuda and cudnn are required, see
docs for more install instructions
pip install --upgrade
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp35-
cp35m-linux_x86_64.whl

EXECUTION /STEP 1
OK

EXECUTION /STEP 2
OK

EXECUTION /STEP 3
[joepareti54@xxx tensorflow_tmpdir]$ pip3 install --upgrade virtualenv >>
step3.txt 2>&1
[joepareti54@xxx tensorflow_tmpdir]$ cat step3.txt
Collecting virtualenv
  Downloading
https://files.pythonhosted.org/packages/ed/ea/e20b5cbebf45d3096e8138ab74eda139595d827677f38e9dd543e6015bdf/virtualenv-15.2.0-py2.py3-none-any.whl
(2.6MB)
Installing collected packages: virtualenv
Exception:
Traceback (most recent call last):
  File
"/anaconda/envs/py35/lib/python3.5/site-packages/pip/basecommand.py", line
215, in main
status = self.run(options, args)
  File
"/anaconda/envs/py35/lib/python3.5/site-packages/pip/commands/install.py",
line 342, in run
prefix=options.prefix_path,
  File
"/anaconda/envs/py35/lib/python3.5/site-packages/pip/req/req_set.py", line
784, in install
**kwargs
  File
"/anaconda/envs/py35/lib/python3.5/site-packages/pip/req/req_install.py",
line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File
"/anaconda/envs/py35/lib/python3.5/site-packages/pip/req/req_install.py",
line 1064, in move_wheel_files
isolated=self.isolated,
  File "/anaconda/envs/py35/lib/python3.5/site-packages/pip/wheel.py", line
345, in move_wheel_files
clobber(source, lib_dir, True)
  File "/anaconda/envs/py35/lib/python3.5/site-packages/pip/wheel.py", line
323, in clobber
shutil.copyfile(srcfile, destfile)
  File "/anaconda/envs/py35/lib/python3.5/shutil.py", line 115, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied:
'/anaconda/envs/py35/lib/python3.5/site-packages/virtualenv.py'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[joepareti54@xxx tensorflow_tmpdir]$
-- 
https://mail.python.org/mailman/listinfo/python-list