Skip to content

Commit

Permalink
Updated tests scripts to run tests from one directory higher (#461)
Browse files Browse the repository at this point in the history
Summary:
Related to discussion on this with gbleaney.

PR #433 use of relative imports causes `Import beyond top-level package` errors. Internally, relative imports are required to pass the tests whereas on GitHub, this causes issues. This PR fixes that issue by running tests from one directory higher, unblocking #433.

Pull Request resolved: #461

Reviewed By: dkgi

Differential Revision: D30518016

Pulled By: gbleaney

fbshipit-source-id: e7d76f2059bde5110849923887f928459228e0a8
  • Loading branch information
m0mosenpai authored and facebook-github-bot committed Aug 25, 2021
1 parent ee74ba3 commit cf1098a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pysa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
unzip -qq ./stubs/typeshed/typeshed.zip -d ./typeshed/
./scripts/setup.sh --local --no-tests
make -C source
echo "PYTHONPATH=$GITHUB_WORKSPACE:$PYTHONPATH" >> $GITHUB_ENV
echo "PYTHONPATH=$GITHUB_WORKSPACE/..:$PYTHONPATH" >> $GITHUB_ENV
echo "pythonLocation=$GITHUB_WORKSPACE:$pythonLocation" >> $GITHUB_ENV
echo "PYRE_BINARY=$GITHUB_WORKSPACE/source/_build/default/main.exe" >> $GITHUB_ENV
echo "PYRE_TYPESHED=$GITHUB_WORKSPACE/typeshed/typeshed-master/" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-python-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
set -e

SCRIPTS_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "${SCRIPTS_DIRECTORY}/.."
cd "${SCRIPTS_DIRECTORY}/../.."

echo ' Enumerating test files:'
files=$(find client -name '*_test.py' ! -name 'watchman_test.py')
files=$(find 'pyre-check/client' -name '*_test.py' ! -name 'watchman_test.py')
echo "${files}"
if [[ -z "${files}" ]]; then
echo 'No test files found, exiting.'
Expand Down
2 changes: 1 addition & 1 deletion tools/pysa_integration_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def run_pysa_integration_test(
if run_from_source:
command = [
"python",
"-m" "client.pyre",
"-m" "pyre-check.client.pyre",
"--noninteractive",
"analyze",
]
Expand Down

0 comments on commit cf1098a

Please sign in to comment.