betodealmeida opened a new pull request #11193: URL: https://github.com/apache/incubator-superset/pull/11193
### SUMMARY <!--- Describe the change below, including rationale and design decisions --> When running unit tests we import any `superset_config.py` files that are in the path, resulting in inconsistent local tests. I modified the code so that we set an environment flag when running unit tests, and skip importing `superset_config.py` when the flag is set. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> NA ### TEST PLAN <!--- What steps should be taken to verify the changes --> I had this custom configuration file: ```python # superset_config.py PREVENT_UNSAFE_DB_CONNECTIONS = False ``` Running SQLite unit tests will then fail: ```bash $ tox -e py38-sqlite -- tests/databases/api_tests.py::TestDatabaseApi::test_create_database_fail_sqllite ... > self.assertEqual(response_data, expected_response) E AssertionError: {'message': 'Could not connect to database.'} != {'message': {'sqlalchemy_uri': ['SQLite database cann[48 chars].']}} E Diff is 194 characters long. Set self.maxDiff to None to see it. tests/databases/api_tests.py:331: AssertionError ``` With this PR, `superset_config.py` is ignored and the tests pass. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Changes UI - [ ] Requires DB Migration. - [ ] Confirm DB Migration upgrade and downgrade tested. - [ ] Introduces new feature or API - [ ] Removes existing feature or API ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org