Skip to content

Commit

Permalink
Replace deprecated threading.currentThread with threading.current_thr…
Browse files Browse the repository at this point in the history
…ead (#2816)
  • Loading branch information
hugovk authored Jun 19, 2022
1 parent 82c2d37 commit ee1d552
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ name: build
on: [push, pull_request]
env:
environment: gh_actions
FORCE_COLOR: 1
jobs:
std_tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9, 3.10.0]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -41,8 +42,8 @@ jobs:
- name: Run Tests
run: |
py.test -v -s tests/test_import_netmiko.py
py.test -v -s tests/unit/test_base_connection.py
py.test -v -s tests/unit/test_utilities.py
py.test -v -s tests/unit/test_ssh_autodetect.py
py.test -v -s tests/unit/test_connection.py
pytest -v -s tests/test_import_netmiko.py
pytest -v -s tests/unit/test_base_connection.py
pytest -v -s tests/unit/test_utilities.py
pytest -v -s tests/unit/test_ssh_autodetect.py
pytest -v -s tests/unit/test_connection.py
4 changes: 2 additions & 2 deletions docs/netmiko/cli_tools/netmiko_cfg.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h1 class="title">Module <code>netmiko.cli_tools.netmiko_cfg</code></h1>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down Expand Up @@ -369,7 +369,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down
4 changes: 2 additions & 2 deletions docs/netmiko/cli_tools/netmiko_grep.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ <h1 class="title">Module <code>netmiko.cli_tools.netmiko_grep</code></h1>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down Expand Up @@ -352,7 +352,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down
4 changes: 2 additions & 2 deletions docs/netmiko/cli_tools/netmiko_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h1 class="title">Module <code>netmiko.cli_tools.netmiko_show</code></h1>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down Expand Up @@ -351,7 +351,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down
2 changes: 1 addition & 1 deletion examples_old/case16_concurrency/threads_netmiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
my_thread = threading.Thread(target=show_version, args=(a_device,))
my_thread.start()

main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
print(some_thread)
Expand Down
2 changes: 1 addition & 1 deletion netmiko/cli_tools/netmiko_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def main(args):
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down
2 changes: 1 addition & 1 deletion netmiko/cli_tools/netmiko_grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def main(args):
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down
2 changes: 1 addition & 1 deletion netmiko/cli_tools/netmiko_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def main(args):
)
my_thread.start()
# Make sure all threads have finished
main_thread = threading.currentThread()
main_thread = threading.current_thread()
for some_thread in threading.enumerate():
if some_thread != main_thread:
some_thread.join()
Expand Down

0 comments on commit ee1d552

Please sign in to comment.