How to set order of tests based on class in python?

  class, execution, pytest, python, testing

I have two different files, which contain tests. I have structured them like below:
  class TestA:
    def test1():...
    def test2():...
  class TestB:
    def test3():...
    def test4():...

The tests from TestB class are dependent on the results of the tests from TestA class. How can I force the tests from TestB to wait for TestA test executions?
I tried:

class TestB

But this is not working, as the tests from TestB want to exexcute first. How can I solve the issue without renaming the files? And also without specifying the @pytest.mark.order at all the functions from TestB.

Source: Python Questions