Skip to content

Fix tests with Twisted trunk #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributor Guide

Synapse is a Python application that has Rust modules via pyo3 for performance.

## Dev Environment Tips
- Source code is primarily in `synapse/`, tests are in `tests/`.
- Run `poetry install --dev` to install development python dependencies. This will also build and install the Synapse rust code.
- Use `./scripts-dev/lint.sh` to lint the codebase (this attempts to fix issues as well). This should be run and produce no errors before every commit.

## Testing Instructions
- Find the CI plan in the .github/workflows folder.
- Use `poetry run trial tests` to run all unit tests, or `poetry run trial tests.metrics.test_phone_home_stats.PhoneHomeStatsTestCase` (for example) to run a single test case. The commit should pass all tests before you merge.
- Some typing warnings are expected currently. Fix any test or type *errors* until the whole suite is green.
- Add or update relevant tests for the code you change, even if nobody asked.
9 changes: 9 additions & 0 deletions tests/http/federation/test_matrix_federation_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ def setUp(self) -> None:

self.tls_factory = FederationPolicyForHTTPS(config)

# ensure any proxy settings from the environment do not interfere with
# the tests. In some execution environments (like CI or the test
# runner's container) `https_proxy` or `http_proxy` may be preset which
# would cause the agent to attempt to proxy outbound connections.
for var in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY"):
if var in os.environ:
old = os.environ.pop(var)
self.addCleanup(os.environ.__setitem__, var, old)

self.well_known_cache: TTLCache[bytes, Optional[bytes]] = TTLCache(
"test_cache", timer=self.reactor.seconds
)
Expand Down