Re: [asterisk-dev] Python 3 test suite

2022-09-01 Thread Joshua C. Colp
On Thu, Sep 1, 2022 at 12:20 PM  wrote:

> On 9/1/2022 11:12 AM, Joshua C. Colp wrote:
> > On Thu, Sep 1, 2022 at 12:10 PM  > > wrote:
> >
> >
> > I didn't notice any test suite code specifically calling python so
> > this
> > is purely a usage change, right? e.g. I should be running
> > ./runInVenv.sh
> > python3 runtests.py -l as opposed to ./runInVenv.sh python
> > runtests.py -l
> > It seems both may work but python3 would be the "more right" way
> > to do
> > it. So maybe the wiki page for that could be updated but a code
> > change
> > is not needed.
> >
> >
> > runtests.py has python as its executable so you don't need to do
> > "python runtests.py" assuming python3 is the default on the system. If
> > not then you would need to, unless runtests.py was changed to have
> > python3 as its executable.
>
> Ah, now I see what you mean. So that raises the question: shouldn't we
> change #!/usr/bin/env python to #!/usr/bin/env python3?
> If only python3 will work, I don't see the advantage of not specifying
> so explicitly.
>

That is what my original response was covering.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [asterisk-dev] Python 3 test suite

2022-09-01 Thread Joshua C. Colp
On Thu, Sep 1, 2022 at 12:10 PM  wrote:

>
> I didn't notice any test suite code specifically calling python so this
> is purely a usage change, right? e.g. I should be running ./runInVenv.sh
> python3 runtests.py -l as opposed to ./runInVenv.sh python runtests.py -l
> It seems both may work but python3 would be the "more right" way to do
> it. So maybe the wiki page for that could be updated but a code change
> is not needed.
>

runtests.py has python as its executable so you don't need to do "python
runtests.py" assuming python3 is the default on the system. If not then you
would need to, unless runtests.py was changed to have python3 as its
executable.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [asterisk-dev] Python 3 test suite

2022-09-01 Thread Joshua C. Colp
On Thu, Sep 1, 2022 at 10:52 AM  wrote:

> On 9/1/2022 7:53 AM, Joshua C. Colp wrote:
> > On Thu, Sep 1, 2022 at 8:07 AM  > > wrote:
> >
> > On 8/31/2022 7:47 PM, Michael Bradeen wrote:
> > > Hello again!
> > >
> > > The Python3 release of the testsuite has been merged. The wiki has
> > > been updated and will continue to update as things change.
> > >
> > > As indicated before, with this change running the testsuite on
> > Python2
> > > is no longer supported.  Please check the wiki for any questions
> > and
> > > reply on the forum or this email with questions that come up!
> > Thanks for the update Mike, and all the work involved in this,
> >
> > I was able to get the runInVenv.sh script to finally run last
> > night,
> > after installing a few additional Debian packages (python3-dev and
> > python3-venv)
> > (I wonder if an install_prereqs.sh for the test suite might be
> > useful at
> > some point, but that's for a different day)
> >
> >
> > There already is one in the same place as the Asterisk one,
> > contrib/scripts/install_prereq
>
> I went ahead and ran that on a different system.
> At the end, I get:
>
> #
> ## install completed successfully
> #
>
> Testsuite requires python version >= 3.6.8
> Your installed python is
> Python 2.7.18
>
> However, I got this when running:
> (note, this was with setupVenv.sh patched to remove the output direction
> - otherwise you get absolutely nothing)
>

To be specific - you mean when runInVenv.sh is patched to remove the output
redirection. Running setupVenv.sh manually outputs everything.


>
> root@debian11:/usr/src/testsuite# ./runInVenv.sh python runtests.py -l
> Reinstall required, removing and recreating venv
> The virtual environment was not created successfully because ensurepip
> is not
> available.  On Debian/Ubuntu systems, you need to install the python3-venv
> package using the following command.
>
>  apt-get install python3-venv
>
> You may need to use sudo with that command.  After installing the
> python3-venv
> package, recreate your virtual environment.
>
> Failing command: ['/usr/src/testsuite/.venv/bin/python3', '-Im',
> 'ensurepip', '--upgrade', '--default-pip']
>
> One of the pre-reqs that caused issues before is covered, but
> python3-venv still needs to be added to the install_prereq script
> actually. And at the moment, since all errors are going into the ether,
> there's no indication at all of this issue.
>
> I can submit a review to add this pre-req; it sounded like maybe further
> discussion was warranted on the error output redirection but I still
> think that's the more appropriate way to do it.
>

I think adding it to install_prereq is fine. I think removing error output
redirection is fine. It's not going to run every time and clutter things up.


>
> On the upside, now runtests.py can "find" Asterisk stuff, unlike before,
> so install_prereq was actually key to making it work. I'm encountering
> other issues, but at least tests themselves are trying to run, which is
> progress:
>
> root@debian11:/usr/src/testsuite# ./runInVenv.sh python runtests.py
> --test=tests/apps
> Running tests for Asterisk (run 1 of 1)...
>
> Tests to run: 153 * 1 time(s) = 153  Maximum test inactivity time: 0 sec.
> --> Running test
> 'tests/apps/agents/agent_acknowledge/agent_acknowledge_error' ...
> Making sure Asterisk isn't running ...
> Making sure SIPp isn't running...
> Running tests/apps/agents/agent_acknowledge/agent_acknowledge_error ...
> [Sep 01 09:52:09] WARNING[2716462]: asterisk.asterisk:246 errReceived:
> Asterisk 127.0.0.1 received error: ASTdb initialization failed.
> ASTERISK EXITING!
>
> I was wondering if maybe python should be python3, given my default is
> 2.7 apparently, but I guess that wasn't necessary.
>

Referencing an explicit Python version is acceptable in things, so changing
it since it requires 3 is fine.


> I think it would be good to add a note about this to the wiki[1], as
> opposed to install various things ad hoc individually. This page[2] does
> mention the script, but it says it's for Python 2 and makes it seem like
> the script is obsolete, so if that's not the case, then maybe that
> should be updated.
>
> [1] https://wiki.asterisk.org/wiki/display/AST/Using+Python3
> [2]
>
> https://wiki.asterisk.org/wiki/display/AST/Installing+the+Asterisk+Test+Suite
>
> NA
>


-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [asterisk-dev] Python 3 test suite

2022-09-01 Thread Joshua C. Colp
On Thu, Sep 1, 2022 at 10:14 AM  wrote:

> On 9/1/2022 7:53 AM, Joshua C. Colp wrote:
> > On Thu, Sep 1, 2022 at 8:07 AM  > > wrote:
> >
> > On 8/31/2022 7:47 PM, Michael Bradeen wrote:
> > > Hello again!
> > >
> > > The Python3 release of the testsuite has been merged. The wiki has
> > > been updated and will continue to update as things change.
> > >
> > > As indicated before, with this change running the testsuite on
> > Python2
> > > is no longer supported.  Please check the wiki for any questions
> > and
> > > reply on the forum or this email with questions that come up!
> > Thanks for the update Mike, and all the work involved in this,
> >
> > I was able to get the runInVenv.sh script to finally run last
> > night,
> > after installing a few additional Debian packages (python3-dev and
> > python3-venv)
> > (I wonder if an install_prereqs.sh for the test suite might be
> > useful at
> > some point, but that's for a different day)
> >
> >
> > There already is one in the same place as the Asterisk one,
> > contrib/scripts/install_prereq
> Ah, thanks for pointing that out ;)
>
> That script fails for me because it assumes sudo is installed, and the
> test system I ran it on didn't have sudo. I'm not sure if that's a
> reasonable assumption to make, either. I think it's more reasonable to
> have the install process run install_prereq itself as sudo, as opposed
> to making sudo calls within the script. The regular Asterisk
> install_prereq script doesn't have this sudo dependency.
>
> I imagine this type of thing is typically run as root or sudo anyways,
> and if the script needs to ensure it's being run as root (even though
> this is the user's responsibility), it could  check the UID and abort if
> it's not 0.
> Any objection to removing the sudo calls from install_prereq? It's
> unnecessary and causes breakage.
>

Making it work equivalent to the Asterisk one is fine.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [asterisk-dev] Python 3 test suite

2022-09-01 Thread Joshua C. Colp
On Thu, Sep 1, 2022 at 8:07 AM  wrote:

> On 8/31/2022 7:47 PM, Michael Bradeen wrote:
> > Hello again!
> >
> > The Python3 release of the testsuite has been merged.  The wiki has
> > been updated and will continue to update as things change.
> >
> > As indicated before, with this change running the testsuite on Python2
> > is no longer supported.  Please check the wiki for any questions and
> > reply on the forum or this email with questions that come up!
> Thanks for the update Mike, and all the work involved in this,
>
> I was able to get the runInVenv.sh script to finally run last night,
> after installing a few additional Debian packages (python3-dev and
> python3-venv)
> (I wonder if an install_prereqs.sh for the test suite might be useful at
> some point, but that's for a different day)
>

There already is one in the same place as the Asterisk one,
contrib/scripts/install_prereq

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [asterisk-dev] Python 3 test suite

2022-08-31 Thread Michael Bradeen
Hello again!

The Python3 release of the testsuite has been merged.  The wiki has been
updated and will continue to update as things change.

As indicated before, with this change running the testsuite on Python2 is
no longer supported.  Please check the wiki for any questions and reply on
the forum or this email with questions that come up!

https://wiki.asterisk.org/wiki/display/AST/Using+Python3
https://community.asterisk.org/t/python3-testsuite

Thanks,
-Mike

On Wed, Jul 13, 2022 at 10:13 AM Michael Bradeen 
wrote:

> Hi Folks,
>
> There is currently a review on gerrit for the asterisk test suite running
> with Python 3.  This review is against a new development branch based on
> asterisk 16.  The targeted minimum requirements are Python 3.6.8 on
> Centos7.  The python package requirements have been moved to a pair of text
> files for use with a python virtual environment.  A new branch of starpy
> has also been crated (1.1) - but if you use the virtual environment as
> intended this will be handled as part of that process.
>
> More information is on the now live wiki page:
> https://wiki.asterisk.org/wiki/display/AST/Using+Python3
>
> I've opened up a forum topic for general questions, but am also available
> by email:
> https://community.asterisk.org/t/python3-testsuite
>
> Currently the working version only exists within the review, so if you
> find a specific issue it can be raised as a comment on the review.
> Eventually we will work out of the dev branch until it's time to move to
> the main branch(es).
>
> Please also note that this is *not* backwards compatible with python
> 2.x.  If you wish to use both side-by-side, the easiest way is to run the
> P3 version from within a virtual environment.
>
> Tests that are currently known failures due to the migration are skipped
> with a 'Python3-issues" tag.
>
> Thanks everyone, I look forward to hearing from you!
> -Mike
> --
>
>
> *Michael Bradeen*
> +1 920-886-8130  <+19208868130>  ext. 6828
> mbrad...@sangoma.com
>


-- 


*Michael Bradeen*
+1 920-886-8130  <+19208868130>  ext. 6828
mbrad...@sangoma.com
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev