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

Error running tests.sh on Ubuntu 16.04 VM instance google cloud #2

Open
shaktikshri opened this issue Mar 5, 2020 · 1 comment
Open

Comments

@shaktikshri
Copy link

shaktikshri commented Mar 5, 2020

Hi, I am on a google cloud VM instance (Ubuntu 16.04) and tried installing this environment by following the steps here https://github.com/mwydmuch/ViZDoom/blob/master/doc/Building.md#-linux
However my bash test.sh fails with the following errors,

(mazeexplorer-env) shakti_shrivastava13@ubuntu-16:~/MazeExplorer$ bash test.sh
============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /home/shakti_shrivastava13/MazeExplorer
collected 12 items

tests/test_compile_acs.py F [ 8%]
tests/test_mazeexplorer.py .FFFF.... [ 83%]
tests/test_vizdoom_gym.py .F [100%]

=================================== FAILURES ===================================
_______________________________ test_compile_acs _______________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_compile_acs0')

def test_compile_acs(tmpdir):
    compile_acs(tmpdir.strpath)
  assert os.path.isfile(os.path.join(tmpdir, "outputs", "maze.o"))

tests/test_compile_acs.py:10:


/usr/lib/python3.5/posixpath.py:89: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join'
args = (local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_compile_acs0'), 'outputs', 'maze.o')
hasstr = False, hasbytes = False
s = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_compile_acs0')

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                          (funcname, s.__class__.__name__)) from None

E TypeError: join() argument must be str or bytes, not 'LocalPath'

/usr/lib/python3.5/genericpath.py:143: TypeError
----------------------------- Captured stdout call -----------------------------
Host byte order: LITTLE endian

"/home/shakti_shrivastava13/MazeExplorer/mazeexplorer/content/maze.acs":
168 lines (1599 included)
4 functions
3 scripts
1 closed
1 open
1 enter
6 global variables
0 world variables
23 map variables
0 global arrays
0 world arrays
object "/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_compile_acs0/outputs/maze.o": 6052 bytes
----------------------------- Captured stderr call -----------------------------

Original ACC Version 1.10 by Ben Gokey
Copyright (c) 1995 Raven Software, Corp.

This is version 1.57 (Mar 5 2020)
This software is not supported by Raven Software or Activision
ZDoom changes and language extensions by Randy Heit
Further changes by Brad Carney
Even more changes by James Bentler
Some additions by Michael "Necromage" Weber
Error reporting improvements and limit expansion by Ty Halderman
Include paths added by Pascal vd Heiden
________________________________ test_save_load ________________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_save_load0')

def test_save_load(tmpdir):
    env = MazeExplorer(mazes_path=tmpdir.mkdir("maze").strpath)
  saved_mazes_destination = os.path.join(tmpdir, "test_mazes")

tests/test_mazeexplorer.py:31:


/usr/lib/python3.5/posixpath.py:89: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join'
args = (local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_save_load0'), 'test_mazes')
hasstr = False, hasbytes = False
s = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_save_load0')

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                          (funcname, s.__class__.__name__)) from None

E TypeError: join() argument must be str or bytes, not 'LocalPath'

/usr/lib/python3.5/genericpath.py:143: TypeError
----------------------------- Captured stdout call -----------------------------
Host byte order: LITTLE endian

"/home/shakti_shrivastava13/MazeExplorer/mazeexplorer/content/maze.acs":
168 lines (1599 included)
4 functions
3 scripts
1 closed
1 open
1 enter
6 global variables
0 world variables
23 map variables
0 global arrays
0 world arrays
object "/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_save_load0/maze/outputs/maze.o": 4936 bytes
----------------------------- Captured stderr call -----------------------------

Original ACC Version 1.10 by Ben Gokey
Copyright (c) 1995 Raven Software, Corp.

This is version 1.57 (Mar 5 2020)
This software is not supported by Raven Software or Activision
ZDoom changes and language extensions by Randy Heit
Further changes by Brad Carney
Even more changes by James Bentler
Some additions by Michael "Necromage" Weber
Error reporting improvements and limit expansion by Ty Halderman
Include paths added by Pascal vd Heiden
_______________________________ test_step_record _______________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_step_record0')

def test_step_record(tmpdir):
    env = MazeExplorer(random_textures=True, mazes_path=tmpdir.strpath)
    env.reset()
    for _ in range(3):
        action = env.action_space.sample()
      observation, *_ = env.step_record(action, tmpdir)

tests/test_mazeexplorer.py:52:


mazeexplorer/vizdoom_gym.py:232: in step_record
imageio.imwrite(os.path.join(record_path, str(datetime.datetime.now()) + ".png"),
/usr/lib/python3.5/posixpath.py:89: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join'
args = (local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_step_record0'), '2020-03-05 19:10:22.011501.png')
hasstr = False, hasbytes = False
s = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_step_record0')

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                          (funcname, s.__class__.__name__)) from None

E TypeError: join() argument must be str or bytes, not 'LocalPath'

/usr/lib/python3.5/genericpath.py:143: TypeError
----------------------------- Captured stdout call -----------------------------
Host byte order: LITTLE endian

"/home/shakti_shrivastava13/MazeExplorer/mazeexplorer/content/maze.acs":
168 lines (1599 included)
4 functions
3 scripts
1 closed
1 open
1 enter
6 global variables
0 world variables
23 map variables
0 global arrays
0 world arrays
object "/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_step_record0/outputs/maze.o": 4936 bytes
----------------------------- Captured stderr call -----------------------------

Original ACC Version 1.10 by Ben Gokey
Copyright (c) 1995 Raven Software, Corp.

This is version 1.57 (Mar 5 2020)
This software is not supported by Raven Software or Activision
ZDoom changes and language extensions by Randy Heit
Further changes by Brad Carney
Even more changes by James Bentler
Some additions by Michael "Necromage" Weber
Error reporting improvements and limit expansion by Ty Halderman
Include paths added by Pascal vd Heiden
_____________________________ test_generate_video ______________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_video0')

def test_generate_video(tmpdir):
    record_path = tmpdir.mkdir("record")

    env = MazeExplorer(mazes_path=tmpdir.strpath)
    env.reset()
    for _ in range(10):
        action = env.action_space.sample()
      env.step_record(action, record_path=record_path)

tests/test_mazeexplorer.py:64:


mazeexplorer/vizdoom_gym.py:232: in step_record
imageio.imwrite(os.path.join(record_path, str(datetime.datetime.now()) + ".png"),
/usr/lib/python3.5/posixpath.py:89: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join'
args = (local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_video0/record'), '2020-03-05 19:10:22.402193.png')
hasstr = False, hasbytes = False
s = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_video0/record')

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                          (funcname, s.__class__.__name__)) from None

E TypeError: join() argument must be str or bytes, not 'LocalPath'

/usr/lib/python3.5/genericpath.py:143: TypeError
----------------------------- Captured stdout call -----------------------------
Host byte order: LITTLE endian

"/home/shakti_shrivastava13/MazeExplorer/mazeexplorer/content/maze.acs":
168 lines (1599 included)
4 functions
3 scripts
1 closed
1 open
1 enter
6 global variables
0 world variables
23 map variables
0 global arrays
0 world arrays
object "/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_video0/outputs/maze.o": 4936 bytes
----------------------------- Captured stderr call -----------------------------

Original ACC Version 1.10 by Ben Gokey
Copyright (c) 1995 Raven Software, Corp.

This is version 1.57 (Mar 5 2020)
This software is not supported by Raven Software or Activision
ZDoom changes and language extensions by Randy Heit
Further changes by Brad Carney
Even more changes by James Bentler
Some additions by Michael "Necromage" Weber
Error reporting improvements and limit expansion by Ty Halderman
Include paths added by Pascal vd Heiden
___________________________ test_generate_with_seed ____________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_with_seed0')

def test_generate_with_seed(tmpdir):
    env = MazeExplorer(10, seed=5, mazes_path=tmpdir.mkdir("maze_1").strpath)
  assert len(set(env.mazes)) == 10

E assert 1 == 10
E + where 1 = len({<mazeexplorer.maze.Maze object at 0x7f1fa4d7ce48>})
E + where {<mazeexplorer.maze.Maze object at 0x7f1fa4d7ce48>} = set({<mazeexplorer.maze.Maze object at 0x7f1fa4d7ce48>})
E + where {<mazeexplorer.maze.Maze object at 0x7f1fa4d7ce48>} = <mazeexplorer.mazeexplorer.MazeExplorer object at 0x7f1fa4d7c828>.mazes

tests/test_mazeexplorer.py:75: AssertionError
----------------------------- Captured stdout call -----------------------------
Host byte order: LITTLE endian

"/home/shakti_shrivastava13/MazeExplorer/mazeexplorer/content/maze.acs":
168 lines (1599 included)
4 functions
3 scripts
1 closed
1 open
1 enter
6 global variables
0 world variables
23 map variables
0 global arrays
0 world arrays
object "/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_generate_with_seed0/maze_1/outputs/maze.o": 4936 bytes
----------------------------- Captured stderr call -----------------------------

Original ACC Version 1.10 by Ben Gokey
Copyright (c) 1995 Raven Software, Corp.

This is version 1.57 (Mar 5 2020)
This software is not supported by Raven Software or Activision
ZDoom changes and language extensions by Randy Heit
Further changes by Brad Carney
Even more changes by James Bentler
Some additions by Michael "Necromage" Weber
Error reporting improvements and limit expansion by Ty Halderman
Include paths added by Pascal vd Heiden
_________________________ test_vizdoom_gym_step_record _________________________

tmpdir = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_vizdoom_gym_step_record0')

def test_vizdoom_gym_step_record(tmpdir):
    test_mazes = os.path.join(dir_path, "mazes", "test.cfg")
    env = VizDoom(test_mazes, number_maps=1)
    env.reset()
    for _ in range(3):
        action = env.action_space.sample()
      observation, *_ = env.step_record(action, tmpdir)

tests/test_vizdoom_gym.py:25:


mazeexplorer/vizdoom_gym.py:232: in step_record
imageio.imwrite(os.path.join(record_path, str(datetime.datetime.now()) + ".png"),
/usr/lib/python3.5/posixpath.py:89: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join'
args = (local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_vizdoom_gym_step_record0'), '2020-03-05 19:10:45.153034.png')
hasstr = False, hasbytes = False
s = local('/tmp/pytest-of-shakti_shrivastava13/pytest-3/test_vizdoom_gym_step_record0')

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                          (funcname, s.__class__.__name__)) from None

E TypeError: join() argument must be str or bytes, not 'LocalPath'

/usr/lib/python3.5/genericpath.py:143: TypeError
========================= 6 failed, 6 passed in 24.63s =========================

Looking for some help in this,

Thanks!

@shaktikshri shaktikshri changed the title Error running tests.sh on linux VM instance google cloud Error running tests.sh on Ubuntu 16.04 VM instance google cloud Mar 5, 2020
@lharries
Copy link
Contributor

Hi @shaktikshri, did you manage to get this sorted?

I imagine this is related to creating temporary directories on Google Cloud VMs.

The tmpdir argument used in PyTest provide[s] a temporary directory unique to the test invocation, created in the base temporary directory. I think you should be able to fix this test by passing in the temporary directory explicitly.

You can do this by running the tests using the following line. Where mydir is a directory that you have created to run the tests.

pytest tests -W ignore --basetemp=mydir

and to use MazeExplorer in your code:

MazeExplorer(mazes_path="mydir")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants