Skip to content
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

nixos/python: add pytest-bdd module. #72495

Merged
merged 2 commits into from Dec 4, 2019
Merged

nixos/python: add pytest-bdd module. #72495

merged 2 commits into from Dec 4, 2019

Conversation

@jm2dev
Copy link
Contributor

@jm2dev jm2dev commented Nov 1, 2019

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@jm2dev jm2dev requested review from FRidh and jonringer as code owners Nov 1, 2019
@nixos-discourse
Copy link

@nixos-discourse nixos-discourse commented Nov 1, 2019

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/pytest-bdd-on-shell-nix/4616/6

@ofborg ofborg bot added the 6.topic: python label Nov 1, 2019
propagatedBuildInputs = [ glob2 Mako parse parse-type py pytest six ];

# Tests require extra dependencies
doCheck = false;

This comment has been minimized.

@jonringer

jonringer Nov 1, 2019
Contributor

that fine... just add them to checkInputs

Suggested change
doCheck = false;
checkInputs = [ mock ];

This comment has been minimized.

@jm2dev

jm2dev Nov 2, 2019
Author Contributor

After running the following command:

find pkgs/development/python-modules -name default.nix | xargs grep doCheck | grep pytest

I suspect we really need that doCheck = false.

This comment has been minimized.

@jonringer

jonringer Nov 2, 2019
Contributor

no... doCheck = false; will make it skip the checkPhase entirely

Here's how i would do this expression:

{ stdenv, buildPythonPackage, fetchFromGitHub
, execnet
, glob2
, Mako
, mock
, parse
, parse-type
, py
, pytest
, six
}:

buildPythonPackage rec {
  pname = "pytest-bdd";
  version = "3.2.1";

  # tests are not included in pypi tarball
  src = fetchFromGitHub {
    owner = "pytest-dev";
    repo = pname;
    rev = version;
    sha256 = "02y28l5h1m9grj54p681qvv7nrhd7ly9jkqdchyw4p0lnmcmnsrd";
  };

  propagatedBuildInputs = [ glob2 Mako parse parse-type py pytest six ];

  checkInputs = [ execnet mock pytest ];
  checkPhase = ''
    pytest
  '';

  meta = with stdenv.lib; {
    description = "BDD library for the py.test runner";
    homepage = https://github.com/pytest-dev/pytest-bdd;
    license = licenses.mit;
    maintainers = with maintainers; [ jm2dev ];
  };
}

This comment has been minimized.

@jm2dev

jm2dev Nov 2, 2019
Author Contributor

Thanks to that "fetchFromGitHub" now I'm aware of the available fetchers, and I suspect you have plenty of experience with python pips.

This comment has been minimized.

@jonringer

jonringer Nov 2, 2019
Contributor

I'm a co-owner of the nixpkgs python packages, only done a few hundred

@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 1, 2019

also, to adhere to contributing guidelines, please rename the PR and commit to:

pythonPackages.pytest-bdd: init at 3.2.0
@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 1, 2019

nix-env failed:
error: while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/.gc-of-borg-outpaths.nix:44:12, called from undefined position:
while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:6, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/attrsets.nix:292:43:
while evaluating 'hydraJob' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:166:14, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:14:
while evaluating the attribute 'meta' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:171:24:
while evaluating the attribute 'maintainers' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/development/python-modules/pytest-bdd/default.nix:21:5:
undefined variable 'jm2dev' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/development/python-modules/pytest-bdd/default.nix:21:39

you need to add yourself to maintainers, please look at #72312 as an example of commit message and history :)

@jm2dev
Copy link
Contributor Author

@jm2dev jm2dev commented Dec 4, 2019

Hi, do we have any updates on this PR?

jm2dev = {
email = "jomarcar@gmail.com";
github = "jm2dev";
githubId = 474643;
name = "José Miguel Martínez Carrasco";
};
Comment on lines +3107 to +3112

This comment has been minimized.

@jonringer

jonringer Dec 4, 2019
Contributor

this should be a separate commit, look at #74389 as an example

This comment has been minimized.

@jm2dev

jm2dev Dec 4, 2019
Author Contributor

Done.

This comment has been minimized.

@jonringer

jonringer Dec 4, 2019
Contributor

please reverse the order of the commits:

git rebase -i HEAD^^
# switch the two lines
# save
git push --force ...

This comment has been minimized.

@jonringer

jonringer Dec 4, 2019
Contributor

otherwise checking out the package commit will fail to evaluate

This comment has been minimized.

@jm2dev

jm2dev Dec 4, 2019
Author Contributor

Output of git log --oneline after following your instructions (and pushing to gh):

0bced444e7f (HEAD -> pytest-bdd, origin/pytest-bdd) pythonPackages.pytest-bdd: init at 3.2.1
b1601d57ec9 maintainers: add jm2dev

though github web doesn't show this way.

This comment has been minimized.

@jonringer

jonringer Dec 4, 2019
Contributor

ah, I looked at your branch, and it still showed it the other way. guess it is just the web view

@jm2dev jm2dev force-pushed the jm2dev:pytest-bdd branch 3 times, most recently from 8a68b6c to 78fa57a Dec 4, 2019
jm2dev added 2 commits Dec 4, 2019
@jm2dev jm2dev force-pushed the jm2dev:pytest-bdd branch from 78fa57a to 0bced44 Dec 4, 2019
Copy link
Contributor

@jonringer jonringer left a comment

diff LGTM
commits LGTM

[5 built, 0.0 MiB DL]
https://github.com/NixOS/nixpkgs/pull/72495
3 package were built:
python27Packages.pytest-bdd python37Packages.pytest-bdd python38Packages.pytest-bdd
@jonringer
Copy link
Contributor

@jonringer jonringer commented Dec 4, 2019

@GrahamcOfBorg build python27Packages.pytest-bdd python37Packages.pytest-bdd python38Packages.pytest-bdd

@jonringer jonringer merged commit 38d945f into NixOS:master Dec 4, 2019
16 checks passed
16 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
python27Packages.pytest-bdd, python37Packages.pytest-bdd, python38Packages.pytest-bdd on aarch64-linux Success
Details
python27Packages.pytest-bdd, python37Packages.pytest-bdd, python38Packages.pytest-bdd on x86_64-darwin Success
Details
python27Packages.pytest-bdd, python37Packages.pytest-bdd, python38Packages.pytest-bdd on x86_64-linux Success
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.