lundberg / respx

Mock HTTPX with awesome request patterns and response side effects 🦋
https://lundberg.github.io/respx
BSD 3-Clause "New" or "Revised" License
581 stars 38 forks source link

Add CONTRIBUTING.md #237

Closed morenoh149 closed 12 months ago

morenoh149 commented 1 year ago

Mentioned in https://github.com/lundberg/respx/issues/233#issuecomment-1581484424

Yeah, that's probably a good idea, e.g. I should describe how to run tests, linting etc 😉

I started writing a contributing.md

# Contributing to REXPX
As an open source project, RESPX welcomes contributions of many forms.

Examples of contributions include:

* Code patches
* Documentation improvements
* Bug reports and patch reviews

## Running Tests
Test reside in the `tests/` directory. You can run them with the [Task](https://taskfile.dev/installation/) tool.

You'll need a virtual environment setup.

* `virtualenv venv`
* `source venv/bin/activate`
* `task tests`

## Linting
Something

* `task lint`

But when I try to run task test I get an error

✗ task test               
^Ctask: Signal received: "interrupt"
ERROR: Operation cancelled by user
^Ctask: Signal received: "interrupt"
Traceback (most recent call last):
  File "/Users/harrymoreno/.asdf/installs/python/3.9.2/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/harrymoreno/.asdf/installs/python/3.9.2/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/__main__.py", line 26, in <module>
    sys.exit(_main())
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 75, in main
    return command.main(cmd_args)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 121, in main
    return self._main(args)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 265, in _main
    self.handle_pip_version_check(options)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 155, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py", line 170, in pip_self_version_check
    best_candidate = finder.find_best_candidate("pip").best_candidate
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 825, in find_all_candidates
    package_links = self.process_project_url(
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/collector.py", line 643, in fetch_page
    return _get_html_page(location, session=self.session)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/collector.py", line 455, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/index/collector.py", line 152, in _get_html_response
    resp = session.get(
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_internal/network/session.py", line 421, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/cachecontrol/adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connection.py", line 308, in connect
    conn = self._new_conn()
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/Users/harrymoreno/Programming/respx/.venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
KeyboardInterrupt
task: Failed to run task "tools": exit status 130

Issue with the tools task?

lundberg commented 1 year ago

Looks like you had internet connection problems during the pip install?

morenoh149 commented 1 year ago

Looks like it was an internet issue because the same task works now. I submitted a PR showing how to run tests and linting.