https://prefect.io logo
m

Matt Drago

05/01/2021, 10:25 PM
Hey Folks,  I'd like to start contributing some tasks that I have been working on (or enhancing) but I'm very new to the python development scene.  I've followed the first few instructions that you have for contributing on https://docs.prefect.io/core/development/overview.html and get a clean check out of a fork of the repository (I'm on the master branch).  I've encountered a few problems: 1. when running `pip install -e ".[dev]" I get a few bdist_wheel command not found. 2. running
pytest
results in 15 Failed tests I figure that I have missed some steps. I'll include what I have done in the thread.
marvin 1
Copy code
git clone <https://github.com/mattdrago/prefect.git>
cd prefect
python3 -m venv .venv
git remote add upstream <https://github.com/PrefectHQ/prefect.git>
git fetch upstream
git merge upstream/master
. .venv/bin/activate
Copy code
pip3 install -e ".[dev]"
This command gives me the first problem:
Copy code
Building wheels for collected packages: pytest-env
  Building wheel for pytest-env (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/matt/projects/prefect/.venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8z_zmtq1/pytest-env/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8z_zmtq1/pytest-env/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-wgtfg7fv
       cwd: /tmp/pip-install-8z_zmtq1/pytest-env/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for pytest-env
  Running setup.py clean for pytest-env
Failed to build pytest-env
Ah, doing
pip3 install wheel
before the
pip3 install -e ".[dev]"
command has resolved that issue.
Ok, second issue is the result of running
pytest
Copy code
13 failed, 5559 passed, 97 skipped, 2 xpassed, 267 warnings in 310.87s (0:05:10)
All of the failed tests have the following at the end of their output:
Copy code
E       assert 1 == 0
E        +  where 1 = <Result TypeError("'>' not supported between instances of 'MagicMock' and 'MagicMock'")>.exit_code
The test files that this is occurring in are:
Copy code
FAILED tests/cli/test_auth.py::test_list_tenants - assert 1 == 0
FAILED tests/cli/test_auth.py::test_list_tokens - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_flows_cloud - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_flows_populated - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_projects - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_projects_populated - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_flow_runs_cloud - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_flow_runs_populated - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_tasks_cloud - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_tasks_populated - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_logs - assert 1 == 0
FAILED tests/cli/test_get.py::test_get_logs_by_id - assert 1 == 0
FAILED tests/cli/test_run.py::test_run_flow_logs - assert 1 == 0
Interesting. Running
pytest tests
results in all of the tests passing.
Now to work out how to run tests of the extras.
A little reading and then guessing and
pip3 install -e ".[all_extras]"
resulted in all of the extra packages being installed. But this failed as I didn't have
sql.h
. To fix this, I ran
sudo apt install unixodbc-dev
(Ubuntu). Re-running the above pip3 install command then succeeded (Note that there were still errors about versions of libraries not matching, but the overall result was success).
k

Kevin Kho

05/02/2021, 4:55 PM
Thanks for circling back and I'm glad you got it figured out @Matt Drago!
m

Matt Drago

05/02/2021, 11:16 PM
No problems @Kevin Kho. I figured it might help someone else (as long as we don't hit the slack message limit). If there is a simpler way of doing what I did, I'd love to hear about it.
4 Views