While North Africa is hot for most of the year, that doesn’t mean it’s a good idea to wear shorts, especially if you’re a woman.
Countries like Morocco, Egypt and Tunisia generally frown on this, as do some countries with large Muslim populations, such as Nigeria.
The citizens of these countries expect tourists to follow their social norms about clothing, and even if you don’t agree, you should still respect this while traveling there.
Many brands make light-weight pants so you don’t have to be hot and sticky.
Wearing longer outerwear can also help keep the insect bites and sunburn away, so you’ll be doing yourself a favor regardless.
Long dresses are also acceptable and will help you stay cool. Just make sure none of it is see-through or cut with revealing slits.