my.fbmessenger: move fbmessenger.py into fbmessenger/export.py
keeping it backwards compatible + conditional warning similar to https://github.com/karlicoss/HPI/pull/179 follow up for https://github.com/seanbreckenridge/HPI/pull/18 for now without the __path__ hacking, will do it in bulk later too lazy to run test_import_warnings.sh on CI for now, but figured I'd commit it for the reference anyway
This commit is contained in:
parent
e30953195c
commit
d1f791dee8
3 changed files with 121 additions and 2 deletions
62
tests/test_import_warnings.sh
Normal file
62
tests/test_import_warnings.sh
Normal file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
errors=0
|
||||
function expect_warn () {
|
||||
echo "check: " "$@"
|
||||
[[ $(2>&1 "$@" | grep -c DEPRECATED) -gt 0 ]] || {
|
||||
echo "ERROR: " "$@"
|
||||
errors=1
|
||||
}
|
||||
}
|
||||
|
||||
function expect_ok () {
|
||||
echo "check: " "$@"
|
||||
[[ $(2>&1 "$@" | grep -c DEPRECATED) -eq 0 ]] || {
|
||||
echo "ERROR: " "$@"
|
||||
errors=1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# TODO actually this one might be ok? nothing wrong with it in principle
|
||||
expect_warn python3 -c 'from my import fbmessenger'
|
||||
echo 'from my import fbmessenger' > /tmp/script.py
|
||||
expect_warn python3 /tmp/script.py
|
||||
|
||||
expect_warn python3 -c 'from my.fbmessenger import messages'
|
||||
echo 'from my.fbmessenger import messages' > /tmp/script.py
|
||||
expect_warn python3 /tmp/script.py
|
||||
|
||||
expect_warn python3 -c 'from my.fbmessenger import *'
|
||||
echo 'from my.fbmessenger import *' > /tmp/script.py
|
||||
expect_warn python3 /tmp/script.py
|
||||
|
||||
expect_warn python3 -c 'import my.fbmessenger'
|
||||
echo 'import my.fbmessenger' > /tmp/script.py
|
||||
expect_warn python3 /tmp/script.py
|
||||
|
||||
expect_warn python3 -m my.core query my.fbmessenger.messages
|
||||
expect_warn python3 -m my.core doctor my.fbmessenger
|
||||
|
||||
|
||||
expect_ok python3 -c 'from my.fbmessenger.export import *'
|
||||
echo 'from my.fbmessenger.export import *' > /tmp/script.py
|
||||
expect_ok python3 /tmp/script.py
|
||||
|
||||
|
||||
# TODO kinda annoying: this doesn't work, and doesn't seem like traceback has anything
|
||||
# guess it's fine, kind of a border case
|
||||
# expect_ok python3 -c 'from my.fbmessenger import export'
|
||||
echo 'from my.fbmessenger import export' > /tmp/script.py
|
||||
expect_ok python3 /tmp/script.py
|
||||
|
||||
expect_ok python3 -c 'import my.fbmessenger.export'
|
||||
echo 'import my.fbmessenger.export' > /tmp/script.py
|
||||
expect_ok python3 /tmp/script.py
|
||||
|
||||
expect_ok python3 -m my.core query my.fbmessenger.export.messages
|
||||
expect_ok python3 -m my.core doctor my.fbmessenger.export
|
||||
|
||||
|
||||
exit $errors
|
Loading…
Add table
Add a link
Reference in a new issue