Git Product home page Git Product logo

Comments (11)

molovo avatar molovo commented on July 17, 2024

Yep, that's intended bahaviour - the run helpers runs the command in a subprocess in isolation, purely so that the $output and $state can be asserted against. To do something like the above, you'd be better off with one of the following options:

# Call the full path firectly
run cat foo/bar

# Or, if the cd is absolutely necessary, run it in the main
# test scope, so that it affects the test process, and is not
# run in an isolated subprocess
cd foo
run cat bar

from zunit.

MichaelAquilina avatar MichaelAquilina commented on July 17, 2024

In my case the second option seems necessary as cd'ing to the directory is part of the test (this is for testing https://github.com/MichaelAquilina/zsh-autoswitch-virtualenv).

However, for some reason the cd fails without any good reason. I am guessing this is more to do with what my plugin is doing than zunit so I feel like I need to dig into this more.

from zunit.

molovo avatar molovo commented on July 17, 2024

Is it the master branch which is failing? I spotted this typo in the @setup function if that helps. It's present in all three test files.

I'll download a copy of that repo when I get home and take a look

from zunit.

MichaelAquilina avatar MichaelAquilina commented on July 17, 2024

That should work, It's a zsh shortcut:

$ echo =virtualenvwrapper.sh                
/home/michael/.virtualenvs/zsh-autoswitch-virtualenv/bin/virtualenvwrapper.sh

Its almost equivalent to which

from zunit.

molovo avatar molovo commented on July 17, 2024

Oh, nice. I hadn't heard of that before. I figured it was a variable assignment

from zunit.

molovo avatar molovo commented on July 17, 2024

I'm getting errors when I'm running the tests that the virtualenvwrapper.sh script can't be found. Am I looking at the wrong branch? (This is on master)

TAP version 13
not ok 1 - Failure: changing to a directory without .venv defaults
  ---
  message: __zunit_test_setup:1: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 2 - Failure: changing to a directory with .venv autoswitches
  ---
  message: __zunit_test_setup:1: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 3 - Failure: chpwd functions are loaded
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 4 - Failure: _check_venv_path with non-existent path
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 5 - Failure: _check_venv_path with no venv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 6 - Failure: _check_venv_path with existing venv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 7 - Failure: _check_venv_path in subdirectory with parent venv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 8 - Failure: rmvenv with no .venv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 9 - Failure: rmvenv with existing .venv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
not ok 10 - Failure: rmvenv with existing .venv with deleted virtualenv
  ---
  message: __zunit_test_setup:2: virtualenvwrapper.sh not found
  severity: fail
  ...
1..10

from zunit.

MichaelAquilina avatar MichaelAquilina commented on July 17, 2024

Have you installed virtualenvwrapper?

pip install virtualenvwrapper

You will probably need to use sudo to install that (or use a python virtualenv)

from zunit.

molovo avatar molovo commented on July 17, 2024

Ah, that would help. Can you tell I'm not a python guy? 😂

from zunit.

MichaelAquilina avatar MichaelAquilina commented on July 17, 2024

haha no problem! I was away in Germany the past few days so I havent managed to give this a look since we last spoke. Any luck from your side? I will probably try find some time today to try clean this all up

from zunit.

molovo avatar molovo commented on July 17, 2024

Sorry, I haven't got anywhere with this. I've had a couple of attempts, but I've had no luck getting virtualenvwrapper itself set up properly in order to run these tests. If you have a Vagrantfile/Dockerfile with an environment where this runs I'd be happy to take another look in that environment.

However, looking at the travis output from the master branch, ZUnit doesn't appear to be doing anything that it's not supposed to. Did the cd failure that you reference above happen in master, or another unpublished branch?

from zunit.

MichaelAquilina avatar MichaelAquilina commented on July 17, 2024

I need to give the tests for this project a proper look because i noticed quite a few are passing automatically due to the contains bug. So better I gather some more information for you first :)

from zunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.